summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-06-12 22:18:36 +0100
committerDr. Stephen Henson <steve@openssl.org>2015-06-13 12:25:42 +0100
commitf2dc4d517fa11208b90ba0e92a2590f8cfdafb28 (patch)
tree5ebcfd486230d18c44503f6d62bf056c66cc2977 /crypto
parent1ae3fdbe6a7e78eef4d7678cb08ff468481c24ad (diff)
Encode b == NULL or blen == 0 as zero.
PR#3904 Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asn1/a_int.c4
1 files 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 {