summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2014-06-27 03:21:10 +0100
committerDr. Stephen Henson <steve@openssl.org>2014-06-27 15:33:18 +0100
commit9fb10cfe6b9f0408d9de613c5ed7bf5c2530f5e5 (patch)
tree0477704cc342c48e654ad5ca10405720b8027f4d /apps
parenta20a6366c8d769020d5fcb49e4e01bdf5b2d811e (diff)
Memory leak and NULL dereference fixes.
PR#3403 (cherry picked from commit d2aea038297e0c64ca66e6844cbb37377365885e) Conflicts: apps/crl2p7.c crypto/asn1/a_utctm.c crypto/asn1/ameth_lib.c crypto/asn1/bio_asn1.c
Diffstat (limited to 'apps')
-rw-r--r--apps/apps.c4
-rw-r--r--apps/ca.c3
-rw-r--r--apps/crl2p7.c8
3 files changed, 14 insertions, 1 deletions
diff --git a/apps/apps.c b/apps/apps.c
index ce8d9c9a7d..792b2540f3 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -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);
diff --git a/apps/ca.c b/apps/ca.c
index 651c5a648a..d6984ba8fd 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -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;
diff --git a/apps/crl2p7.c b/apps/crl2p7.c
index b2f2d121d5..f164a3ad94 100644
--- a/apps/crl2p7.c
+++ b/apps/crl2p7.c
@@ -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
{