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:22:07 +0000 (22:22 +0100)
GH: #1322
(cherry picked from commit 5e3553c2de9a365479324b8ba8b998f0cce3e527)

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
crypto/asn1/tasn_prn.c

index 1dae46bc3dec94029051e894a2002220a5eeccb5..f628caddbd05fd6976202b101a295b3ba6b61ecc 100644 (file)
@@ -447,6 +447,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);