diff options
author | rpointel <> | 2015-07-20 18:23:52 +0000 |
---|---|---|
committer | rpointel <> | 2015-07-20 18:23:52 +0000 |
commit | d43868803f4819bd2369eda390f010284b476c3f (patch) | |
tree | 6ab4c4b798f7a5d905ee5928c0635551ba11b7f3 | |
parent | 07bef4c29af7c18ac9a973f7e92cf27c346fd771 (diff) | |
download | openbsd-d43868803f4819bd2369eda390f010284b476c3f.tar.gz openbsd-d43868803f4819bd2369eda390f010284b476c3f.tar.bz2 openbsd-d43868803f4819bd2369eda390f010284b476c3f.zip |
check the sigbuf value before using it.
ok miod@ (thanks).
-rw-r--r-- | src/usr.bin/openssl/dgst.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/usr.bin/openssl/dgst.c b/src/usr.bin/openssl/dgst.c index 655b2083d0..c9ac057d01 100644 --- a/src/usr.bin/openssl/dgst.c +++ b/src/usr.bin/openssl/dgst.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dgst.c,v 1.2 2015/07/20 17:10:45 doug Exp $ */ | 1 | /* $OpenBSD: dgst.c,v 1.3 2015/07/20 18:23:52 rpointel Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -393,9 +393,14 @@ mac_end: | |||
393 | 393 | ||
394 | if (sigfile && sigkey) { | 394 | if (sigfile && sigkey) { |
395 | BIO *sigbio; | 395 | BIO *sigbio; |
396 | sigbio = BIO_new_file(sigfile, "rb"); | ||
397 | siglen = EVP_PKEY_size(sigkey); | 396 | siglen = EVP_PKEY_size(sigkey); |
398 | sigbuf = malloc(siglen); | 397 | sigbuf = malloc(siglen); |
398 | if (sigbuf == NULL) { | ||
399 | BIO_printf(bio_err, "out of memory\n"); | ||
400 | ERR_print_errors(bio_err); | ||
401 | goto end; | ||
402 | } | ||
403 | sigbio = BIO_new_file(sigfile, "rb"); | ||
399 | if (!sigbio) { | 404 | if (!sigbio) { |
400 | BIO_printf(bio_err, "Error opening signature file %s\n", | 405 | BIO_printf(bio_err, "Error opening signature file %s\n", |
401 | sigfile); | 406 | sigfile); |