]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix invalid free
authorKurt Roeckx <kurt@roeckx.be>
Sun, 28 Feb 2016 10:40:12 +0000 (11:40 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Sun, 28 Feb 2016 12:59:57 +0000 (13:59 +0100)
Also removes an extra initializer, the master branch has a extra field.

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/asn1/tasn_dec.c

index 97b18358a9b707c2e7dc0c545d21c348e5f97fee..5a507967c894f2d8716b8a8a8ad327c4772854a9 100644 (file)
@@ -715,9 +715,9 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
 {
     int ret = 0, utype;
     long plen;
-    char cst, inf, free_cont = 1;
+    char cst, inf, free_cont = 0;
     const unsigned char *p;
-    BUF_MEM buf = { 0, NULL, 0, 0 };
+    BUF_MEM buf = { 0, NULL, 0 };
     const unsigned char *cont = NULL;
     long len;
     if (!pval) {
@@ -801,6 +801,9 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
             ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_TYPE_NOT_PRIMITIVE);
             return 0;
         }
+
+        /* Free any returned 'buf' content */
+        free_cont = 1;
         /*
          * Should really check the internal tags are correct but some things
          * may get this wrong. The relevant specs say that constructed string