Commit 9fb10cfe authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Memory leak and NULL dereference fixes.

PR#3403
(cherry picked from commit d2aea038)

Conflicts:

	apps/crl2p7.c
	crypto/asn1/a_utctm.c
	crypto/asn1/ameth_lib.c
	crypto/asn1/bio_asn1.c
parent a20a6366
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -362,6 +362,8 @@ int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
		{
		arg->count=20;
		arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count);
		if (arg->data == NULL)
			return 0;
		}
	for (i=0; i<arg->count; i++)
		arg->data[i]=NULL;
@@ -1429,6 +1431,8 @@ char *make_config_name()

	len=strlen(t)+strlen(OPENSSL_CONF)+2;
	p=OPENSSL_malloc(len);
	if (p == NULL)
		return NULL;
	BUF_strlcpy(p,t,len);
#ifndef OPENSSL_SYS_VMS
	BUF_strlcat(p,"/",len);
+3 −0
Original line number Diff line number Diff line
@@ -2751,6 +2751,9 @@ char *make_revocation_str(int rev_type, char *rev_arg)

	revtm = X509_gmtime_adj(NULL, 0);

	if (!revtm)
		return NULL;

	i = revtm->length + 1;

	if (reason) i += strlen(reason) + 1;
+7 −1
Original line number Diff line number Diff line
@@ -142,7 +142,13 @@ int MAIN(int argc, char **argv)
			{
			if (--argc < 1) goto bad;
			if(!certflst) certflst = sk_new_null();
			sk_push(certflst,*(++argv));
			if (!certflst)
				goto end;
			if (!sk_push(certflst,*(++argv)))
				{
				sk_free(certflst);
				goto end;
				}
			}
		else
			{
+2 −0
Original line number Diff line number Diff line
@@ -595,6 +595,8 @@ static STACK_OF(MIME_HEADER) *mime_parse_hdr(BIO *bio)
	int len, state, save_state = 0;

	headers = sk_MIME_HEADER_new(mime_hdr_cmp);
	if (!headers)
		return NULL;
	while ((len = BIO_gets(bio, linebuf, MAX_SMLEN)) > 0) {
	/* If whitespace at line start then continuation line */
	if(mhdr && isspace((unsigned char)linebuf[0])) state = MIME_NAME;
+10 −2
Original line number Diff line number Diff line
@@ -134,15 +134,23 @@ ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, ASN1_STRING **oct)
		
	if (!(octmp->length = i2d(obj, NULL))) {
		ASN1err(ASN1_F_ASN1_PACK_STRING,ASN1_R_ENCODE_ERROR);
		return NULL;
		goto err;
	}
	if (!(p = OPENSSL_malloc (octmp->length))) {
		ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE);
		return NULL;
		goto err;
	}
	octmp->data = p;
	i2d (obj, &p);
	return octmp;
	err:
	if (!oct || !*oct)
		{
		ASN1_STRING_free(octmp);
		if (oct)
			*oct = NULL;
		}
	return NULL;
}

#endif
Loading