From: Dr. Stephen Henson Date: Fri, 12 Jun 2015 21:18:36 +0000 (+0100) Subject: Encode b == NULL or blen == 0 as zero. X-Git-Tag: OpenSSL_1_1_0-pre1~993 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2dc4d517fa11208b90ba0e92a2590f8cfdafb28;p=openssl Encode b == NULL or blen == 0 as zero. PR#3904 Reviewed-by: Rich Salz --- 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 {