Fixed a crash in print_notice.
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Tue, 14 Mar 2017 14:10:52 +0000 (15:10 +0100)
committerRich Salz <rsalz@openssl.org>
Wed, 15 Mar 2017 21:32:28 +0000 (17:32 -0400)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2935)

crypto/x509v3/v3_cpols.c

index f717e132d4a0b3f9798f0bcf45bf510ab599e72f..22c56ba38041d01ba1fe57a2e520631102d0a3ef 100644 (file)
@@ -413,9 +413,15 @@ static void print_notice(BIO *out, USERNOTICE *notice, int indent)
             num = sk_ASN1_INTEGER_value(ref->noticenos, i);
             if (i)
                 BIO_puts(out, ", ");
-            tmp = i2s_ASN1_INTEGER(NULL, num);
-            BIO_puts(out, tmp);
-            OPENSSL_free(tmp);
+            if (num == NULL)
+                BIO_puts(out, "(null)");
+            else {
+                tmp = i2s_ASN1_INTEGER(NULL, num);
+                if (tmp == NULL)
+                    return;
+                BIO_puts(out, tmp);
+                OPENSSL_free(tmp);
+            }
         }
         BIO_puts(out, "\n");
     }