summaryrefslogtreecommitdiffstats
path: root/apps/ca.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-03-04 17:49:51 +0000
committerMatt Caswell <matt@openssl.org>2015-03-05 09:15:08 +0000
commitd6b4a41d100c2d3b401baf8edc34085ff610c5ba (patch)
tree8218609640b11832193a700d07a139f4246d8ecd /apps/ca.c
parent9fdbaf3a322689a58381c724e4f3497320a69581 (diff)
Unchecked malloc fixes
Miscellaneous unchecked malloc fixes. Also fixed some mem leaks on error paths as I spotted them along the way. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 918bb8652969fd53f0c390c1cd909265ed502c7e) Conflicts: crypto/bio/bss_dgram.c
Diffstat (limited to 'apps/ca.c')
-rw-r--r--apps/ca.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/ca.c b/apps/ca.c
index f0a19cf11c..3215c56dbf 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -563,10 +563,18 @@ int MAIN(int argc, char **argv)
#ifdef OPENSSL_SYS_VMS
len = strlen(s) + sizeof(CONFIG_FILE);
tofree = OPENSSL_malloc(len);
+ if(!tofree) {
+ BIO_printf(bio_err, "Out of memory\n");
+ goto err;
+ }
strcpy(tofree, s);
#else
len = strlen(s) + sizeof(CONFIG_FILE) + 1;
tofree = OPENSSL_malloc(len);
+ if(!tofree) {
+ BIO_printf(bio_err, "Out of memory\n");
+ goto err;
+ }
BUF_strlcpy(tofree, s, len);
BUF_strlcat(tofree, "/", len);
#endif