From 32baafb2f6fb2a424824df08232d86765f554880 Mon Sep 17 00:00:00 2001 From: Kurt Roeckx Date: Sat, 16 Jul 2016 16:56:54 +0200 Subject: [PATCH] Return error when trying to print invalid ASN1 integer GH: #1322 (cherry picked from commit 5e3553c2de9a365479324b8ba8b998f0cce3e527) Reviewed-by: Rich Salz Reviewed-by: Stephen Henson --- crypto/asn1/tasn_prn.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crypto/asn1/tasn_prn.c b/crypto/asn1/tasn_prn.c index 1dae46bc3d..f628caddbd 100644 --- a/crypto/asn1/tasn_prn.c +++ b/crypto/asn1/tasn_prn.c @@ -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);