diff options
author | Doug Hogan <doug@cvs.openbsd.org> | 2015-07-20 03:28:05 +0000 |
---|---|---|
committer | Doug Hogan <doug@cvs.openbsd.org> | 2015-07-20 03:28:05 +0000 |
commit | 5c00a62ddc03b07b614d3a344e6fe118e43e054e (patch) | |
tree | 1d4e98478806493259fd0063cc9423ba755f27ff /usr.bin/openssl | |
parent | 9c7480b6f71195f12d74b0df875b00c27f575a9b (diff) |
Check return value for ENGINE_ctrl and ENGINE_ctrl_cmd.
Fixes Coverity issue 21645.
ok bcook@
Diffstat (limited to 'usr.bin/openssl')
-rw-r--r-- | usr.bin/openssl/apps.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/usr.bin/openssl/apps.c b/usr.bin/openssl/apps.c index 230ebd5a425..d01f75c7cbf 100644 --- a/usr.bin/openssl/apps.c +++ b/usr.bin/openssl/apps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apps.c,v 1.30 2015/07/20 02:41:10 doug Exp $ */ +/* $OpenBSD: apps.c,v 1.31 2015/07/20 03:28:04 doug Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * @@ -1269,10 +1269,21 @@ setup_engine(BIO *err, const char *engine, int debug) return NULL; } if (debug) { - ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM, - 0, err, 0); + if (ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM, + 0, err, 0) <= 0) { + BIO_printf(err, "Cannot set logstream for " + "engine \"%s\"\n", engine); + ERR_print_errors(err); + ENGINE_free(e); + return NULL; + } + } + if (!ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0, ui_method, 0, 1)) { + BIO_printf(err, "can't set user interface\n"); + ERR_print_errors(err); + ENGINE_free(e); + return NULL; } - ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0, ui_method, 0, 1); if (!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { BIO_printf(err, "can't use that engine\n"); ERR_print_errors(err); |