summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/a_bytes.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>1999-10-04 12:08:59 +0000
committerDr. Stephen Henson <steve@openssl.org>1999-10-04 12:08:59 +0000
commit393f2c651d154a8d576969f24317536f89f28649 (patch)
treec8487a89046d6398fb6a6f320356b6cdca7b0987 /crypto/asn1/a_bytes.c
parentf846335657f090ed7cc45face7b9955f6684fd5d (diff)
Fix for d2i_ASN1_bytes and stop PKCS#7 routines crashing is signed message
contains no certificates. Also fix typo in RANLIB changes.
Diffstat (limited to 'crypto/asn1/a_bytes.c')
-rw-r--r--crypto/asn1/a_bytes.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/asn1/a_bytes.c b/crypto/asn1/a_bytes.c
index e452e03b88..c894f5664c 100644
--- a/crypto/asn1/a_bytes.c
+++ b/crypto/asn1/a_bytes.c
@@ -219,7 +219,7 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
if ((ret->length < len) || (ret->data == NULL))
{
if (ret->data != NULL) Free((char *)ret->data);
- s=(unsigned char *)Malloc((int)len);
+ s=(unsigned char *)Malloc((int)len + 1);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
@@ -229,6 +229,7 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
else
s=ret->data;
memcpy(s,p,(int)len);
+ s[len] = '\0';
p+=len;
}
else