From 84d60be075f21534ffae4e31dce9719742b6f7fa Mon Sep 17 00:00:00 2001 From: doug <> Date: Mon, 20 Jul 2015 03:28:04 +0000 Subject: Check return value for ENGINE_ctrl and ENGINE_ctrl_cmd. Fixes Coverity issue 21645. ok bcook@ --- src/usr.bin/openssl/apps.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c index 230ebd5a42..d01f75c7cb 100644 --- a/src/usr.bin/openssl/apps.c +++ b/src/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 * @@ -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); -- cgit v1.2.3-55-g6feb