summaryrefslogtreecommitdiffstats
path: root/crypto
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
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')
-rw-r--r--crypto/asn1/a_bytes.c3
-rw-r--r--crypto/x509/x509_cmp.c2
2 files changed, 4 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
diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c
index be29979092..6213ec2f8d 100644
--- a/crypto/x509/x509_cmp.c
+++ b/crypto/x509/x509_cmp.c
@@ -207,6 +207,8 @@ X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name,
X509_CINF cinf;
X509 x,*x509=NULL;
+ if(!sk) return NULL;
+
x.cert_info= &cinf;
cinf.serialNumber=serial;
cinf.issuer=name;