Don't write out a bad OID
authorMatt Caswell <matt@openssl.org>
Thu, 22 Mar 2018 14:33:05 +0000 (14:33 +0000)
committerMatt Caswell <matt@openssl.org>
Tue, 27 Mar 2018 14:57:52 +0000 (15:57 +0100)
If we don't have OID data for an object then we should fail if we
are asked to encode the ASN.1 for that OID.

Fixes #5723

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5725)

crypto/asn1/tasn_enc.c

index caa4869..8b562ba 100644 (file)
@@ -528,6 +528,8 @@ static int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
         otmp = (ASN1_OBJECT *)*pval;
         cont = otmp->data;
         len = otmp->length;
+        if (cont == NULL || len == 0)
+            return -1;
         break;
 
     case V_ASN1_NULL: