Handle embed flag in ASN1_STRING_copy().
authorDr. Stephen Henson <steve@openssl.org>
Sun, 11 Oct 2015 22:25:08 +0000 (23:25 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 15 Oct 2015 14:36:57 +0000 (15:36 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/asn1/asn1_lib.c

index 12248dbf780a83231e064fadfd1222a0cb1d72e9..ef9223c485b7fa8a57762245dae121c9b7ce8bc4 100644 (file)
@@ -284,7 +284,9 @@ int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)
     dst->type = str->type;
     if (!ASN1_STRING_set(dst, str->data, str->length))
         return 0;
-    dst->flags = str->flags;
+    /* Copy flags but preserve embed value */
+    dst->flags &= ASN1_STRING_FLAG_EMBED;
+    dst->flags |= str->flags & ~ASN1_STRING_FLAG_EMBED;
     return 1;
 }