From 393f2c651d154a8d576969f24317536f89f28649 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Mon, 4 Oct 1999 12:08:59 +0000 Subject: Fix for d2i_ASN1_bytes and stop PKCS#7 routines crashing is signed message contains no certificates. Also fix typo in RANLIB changes. --- crypto/asn1/a_bytes.c | 3 ++- crypto/x509/x509_cmp.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'crypto') 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; -- cgit v1.2.3