Encode b == NULL or blen == 0 as zero.

PR#3904

Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
Dr. Stephen Henson 2015-06-12 22:18:36 +01:00
parent 1ae3fdbe6a
commit f2dc4d517f

View 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 {