Don't set *pval to NULL in ASN1_item_ex_new.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 2 Apr 2015 12:45:14 +0000 (13:45 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 10 Apr 2015 18:50:51 +0000 (19:50 +0100)
While *pval is usually a pointer in rare circumstances it can be a long
value. One some platforms (e.g. WIN64) where
sizeof(long) < sizeof(ASN1_VALUE *) this will write past the field.

*pval is initialised correctly in the rest of ASN1_item_ex_new so setting it
to NULL is unecessary anyway.

Thanks to Julien Kauffmann for reporting this issue.

Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/asn1/tasn_new.c

index 1b36ecc14997afae83ed204947ebe3d5b24cda9f..aeced95232df17f4180784762884d83e95e82585 100644 (file)
@@ -94,8 +94,6 @@ int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
     else
         asn1_cb = 0;
 
-    *pval = NULL;
-
 #ifdef CRYPTO_MDEBUG
     if (it->sname)
         CRYPTO_push_info(it->sname);