From 85e8decc165767cfb518931944b6eac144a53930 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Mon, 13 Sep 2004 22:30:31 +0000 Subject: [PATCH] ASN1_STRING_to_UTF8() assumed that the MBSTRING_* flags were of the form MBSTRING_FLAG|nbyte where "nbyte" is the number of bytes per character. Unfortunately this isn't so and we can't change the #defines because this would break binary compatibility, so for 0.9.7X only translate between the two. --- crypto/asn1/a_strex.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crypto/asn1/a_strex.c b/crypto/asn1/a_strex.c index bde666a6ff..a07122ba47 100644 --- a/crypto/asn1/a_strex.c +++ b/crypto/asn1/a_strex.c @@ -3,7 +3,7 @@ * project 2000. */ /* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. + * Copyright (c) 2000-2004 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -553,7 +553,12 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in) if((type < 0) || (type > 30)) return -1; mbflag = tag2nbyte[type]; if(mbflag == -1) return -1; - mbflag |= MBSTRING_FLAG; + if (mbflag == 0) + mbflag = MBSTRING_UTF8; + else if (mbflag == 4) + mbflag = MBSTRING_UNIV; + else + mbflag |= MBSTRING_FLAG; stmp.data = NULL; ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); if(ret < 0) return ret; -- 2.25.1