diff options
author | Matt Caswell <matt@openssl.org> | 2015-03-04 17:49:51 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-03-05 09:09:57 +0000 |
commit | 918bb8652969fd53f0c390c1cd909265ed502c7e (patch) | |
tree | 883afa725e4529a992611b5b02e8b5c784463e99 /apps/srp.c | |
parent | 618be04e407a7800a7198ac87fa5e8cee7c6e10b (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>
Diffstat (limited to 'apps/srp.c')
-rw-r--r-- | apps/srp.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/srp.c b/apps/srp.c index e832535dd1..b9312f8dfc 100644 --- a/apps/srp.c +++ b/apps/srp.c @@ -437,10 +437,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 |