Return an error in ASN1_TYPE_unpack_sequence if argument is NULL
authorDr. Stephen Henson <steve@openssl.org>
Sun, 3 May 2015 23:59:48 +0000 (00:59 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 4 May 2015 12:05:31 +0000 (13:05 +0100)
Thanks to Brian Carpenter for reporting this issue.

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

index 864ebec0f9ca71a7388d1cce14278a2b63c5dc8f..283baaaeaed26e2dbcee3b21bfd1639de9ed5dd0 100644 (file)
@@ -179,7 +179,7 @@ ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t)
 
 void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t)
 {
-    if (t->type != V_ASN1_SEQUENCE || t->value.sequence == NULL)
+    if (t == NULL || t->type != V_ASN1_SEQUENCE || t->value.sequence == NULL)
         return NULL;
     return ASN1_item_unpack(t->value.sequence, it);
 }