From f2dc4d517fa11208b90ba0e92a2590f8cfdafb28 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Fri, 12 Jun 2015 22:18:36 +0100 Subject: [PATCH] Encode b == NULL or blen == 0 as zero. PR#3904 Reviewed-by: Rich Salz --- crypto/asn1/a_int.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c index 9a58378b8a..0d020e0c13 100644 --- a/crypto/asn1/a_int.c +++ b/crypto/asn1/a_int.c @@ -158,8 +158,8 @@ static size_t i2c_ibuf(const unsigned char *b, size_t blen, int neg, if (pad) *(p++) = pb; - if (blen == 0) - *(p++) = 0; + if (b == NULL || blen == 0) + *p = 0; else if (!neg) memcpy(p, b, blen); else { -- 2.40.0