ASN1_primitive_new NULL param handling
authorMatt Caswell <matt@openssl.org>
Wed, 11 Mar 2015 16:00:01 +0000 (16:00 +0000)
committerMatt Caswell <matt@openssl.org>
Thu, 12 Mar 2015 09:20:45 +0000 (09:20 +0000)
commit9e488fd6ab2c295941e91a47ab7bcd346b7540c7
tree3c348938fcefe425defbd5066e0a5a088d4c5008
parenta01087027bd0c5ec053d4eabd972bd942bfcd92f
ASN1_primitive_new NULL param handling

ASN1_primitive_new takes an ASN1_ITEM * param |it|. There are a couple
of conditional code paths that check whether |it| is NULL or not - but
later |it| is deref'd unconditionally. If |it| was ever really NULL then
this would seg fault. In practice ASN1_primitive_new is marked as an
internal function in the public header file. The only places it is ever
used internally always pass a non NULL parameter for |it|. Therefore, change
the code to sanity check that |it| is not NULL, and remove the conditional
checking.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
crypto/asn1/tasn_new.c