Encode b == NULL or blen == 0 as zero.
authorDr. Stephen Henson <steve@openssl.org>
Fri, 12 Jun 2015 21:18:36 +0000 (22:18 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 13 Jun 2015 11:25:42 +0000 (12:25 +0100)
PR#3904

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/asn1/a_int.c

index 9a58378b8a61132f02d34870b029ed511d65a1c6..0d020e0c13031b440588e6a304685c61693bffc5 100644 (file)
@@ -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 {