diff options
| author | lteo <> | 2015-01-03 03:03:39 +0000 |
|---|---|---|
| committer | lteo <> | 2015-01-03 03:03:39 +0000 |
| commit | 2e4e9fcd58d6e0be5d84f72a2b46fc0aa74b3753 (patch) | |
| tree | a7f6ed7b3df7e1dfc65aa90118a927fc102152fd /src/usr.bin/openssl/rsautl.c | |
| parent | 9e3d67617f8e84835744d796274a8f8e834c244e (diff) | |
| download | openbsd-2e4e9fcd58d6e0be5d84f72a2b46fc0aa74b3753.tar.gz openbsd-2e4e9fcd58d6e0be5d84f72a2b46fc0aa74b3753.tar.bz2 openbsd-2e4e9fcd58d6e0be5d84f72a2b46fc0aa74b3753.zip | |
Check the return values of several reallocarray() calls. While here,
also check the return value of an adjacent malloc() call.
ok jsing@
Diffstat (limited to '')
| -rw-r--r-- | src/usr.bin/openssl/rsautl.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/usr.bin/openssl/rsautl.c b/src/usr.bin/openssl/rsautl.c index 95776d250b..8ce3c0e27c 100644 --- a/src/usr.bin/openssl/rsautl.c +++ b/src/usr.bin/openssl/rsautl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsautl.c,v 1.3 2014/08/28 14:25:48 jsing Exp $ */ | 1 | /* $OpenBSD: rsautl.c,v 1.4 2015/01/03 03:03:39 lteo Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -248,7 +248,15 @@ rsautl_main(int argc, char **argv) | |||
| 248 | keysize = RSA_size(rsa); | 248 | keysize = RSA_size(rsa); |
| 249 | 249 | ||
| 250 | rsa_in = reallocarray(NULL, keysize, 2); | 250 | rsa_in = reallocarray(NULL, keysize, 2); |
| 251 | if (rsa_in == NULL) { | ||
| 252 | BIO_printf(bio_err, "Error allocating memory for input data\n"); | ||
| 253 | exit(1); | ||
| 254 | } | ||
| 251 | rsa_out = malloc(keysize); | 255 | rsa_out = malloc(keysize); |
| 256 | if (rsa_out == NULL) { | ||
| 257 | BIO_printf(bio_err, "Error allocating memory for output data\n"); | ||
| 258 | exit(1); | ||
| 259 | } | ||
| 252 | 260 | ||
| 253 | /* Read the input data */ | 261 | /* Read the input data */ |
| 254 | rsa_inlen = BIO_read(in, rsa_in, keysize * 2); | 262 | rsa_inlen = BIO_read(in, rsa_in, keysize * 2); |
