diff options
| author | doug <> | 2015-07-20 17:10:45 +0000 |
|---|---|---|
| committer | doug <> | 2015-07-20 17:10:45 +0000 |
| commit | 07bef4c29af7c18ac9a973f7e92cf27c346fd771 (patch) | |
| tree | 54e913c323598c1e31eb77b85bfd686a9428b8c9 | |
| parent | 16ffebe50a5acac7636fbc71d70775291cc3930c (diff) | |
| download | openbsd-07bef4c29af7c18ac9a973f7e92cf27c346fd771.tar.gz openbsd-07bef4c29af7c18ac9a973f7e92cf27c346fd771.tar.bz2 openbsd-07bef4c29af7c18ac9a973f7e92cf27c346fd771.zip | |
Avoid dereferencing a NULL.
Move NULL check before use. Fixes Coverity issue 21746.
ok miod@ jsing@
Diffstat (limited to '')
| -rw-r--r-- | src/usr.bin/openssl/dgst.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/usr.bin/openssl/dgst.c b/src/usr.bin/openssl/dgst.c index ab64af9192..655b2083d0 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.1 2014/08/26 17:47:24 jsing Exp $ */ | 1 | /* $OpenBSD: dgst.c,v 1.2 2015/07/20 17:10:45 doug 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 | * |
| @@ -254,8 +254,14 @@ dgst_main(int argc, char **argv) | |||
| 254 | EVP_MD_do_all_sorted(list_md_fn, bio_err); | 254 | EVP_MD_do_all_sorted(list_md_fn, bio_err); |
| 255 | goto end; | 255 | goto end; |
| 256 | } | 256 | } |
| 257 | |||
| 257 | in = BIO_new(BIO_s_file()); | 258 | in = BIO_new(BIO_s_file()); |
| 258 | bmd = BIO_new(BIO_f_md()); | 259 | bmd = BIO_new(BIO_f_md()); |
| 260 | if (in == NULL || bmd == NULL) { | ||
| 261 | ERR_print_errors(bio_err); | ||
| 262 | goto end; | ||
| 263 | } | ||
| 264 | |||
| 259 | if (debug) { | 265 | if (debug) { |
| 260 | BIO_set_callback(in, BIO_debug_callback); | 266 | BIO_set_callback(in, BIO_debug_callback); |
| 261 | /* needed for windows 3.1 */ | 267 | /* needed for windows 3.1 */ |
| @@ -265,10 +271,6 @@ dgst_main(int argc, char **argv) | |||
| 265 | BIO_printf(bio_err, "Error getting password\n"); | 271 | BIO_printf(bio_err, "Error getting password\n"); |
| 266 | goto end; | 272 | goto end; |
| 267 | } | 273 | } |
| 268 | if ((in == NULL) || (bmd == NULL)) { | ||
| 269 | ERR_print_errors(bio_err); | ||
| 270 | goto end; | ||
| 271 | } | ||
| 272 | if (out_bin == -1) { | 274 | if (out_bin == -1) { |
| 273 | if (keyfile) | 275 | if (keyfile) |
| 274 | out_bin = 1; | 276 | out_bin = 1; |
