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 23:38:21 +0000 (19:38 -0400)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2935)
(cherry picked from commit 29d1fad78899e5ae2997b19937a175784b21c996)

crypto/x509v3/v3_cpols.c

index f28acab34edbecc4bab79a99713d4d16d3c5eb36..b99269e7f839a5936037ada7599c53bf2989477f 100644 (file)
@@ -458,9 +458,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");
     }