Return error when trying to print invalid ASN1 integer
authorKurt Roeckx <kurt@roeckx.be>
Sat, 16 Jul 2016 14:56:54 +0000 (16:56 +0200)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 4 Aug 2016 21:23:22 +0000 (22:23 +0100)
GH: #1322

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
(cherry picked from commit 32baafb2f6fb2a424824df08232d86765f554880)

crypto/asn1/tasn_prn.c

index 5e7d53e9854a6dcc3a741a04c22028269b3cc74e..d163acb81400c459a91429d8764e346ae33a8d9b 100644 (file)
@@ -446,6 +446,8 @@ static int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str,
     char *s;
     int ret = 1;
     s = i2s_ASN1_INTEGER(NULL, str);
+    if (s == NULL)
+        return 0;
     if (BIO_puts(out, s) <= 0)
         ret = 0;
     OPENSSL_free(s);