From: Jiasheng Jiang Date: Fri, 17 Jun 2022 09:44:24 +0000 (+0800) Subject: apps/s_server.c: Add check for OPENSSL_strdup X-Git-Tag: openssl-3.2.0-alpha1~2502 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a6a2dd9f60b3f3e93de1337ee84f9e8f33bc86a8;p=thirdparty%2Fopenssl.git apps/s_server.c: Add check for OPENSSL_strdup As the potential failure of the OPENSSL_strdup(), it should be better to check the return value and return error if fails. Signed-off-by: Jiasheng Jiang Reviewed-by: Todd Short Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/18595) --- diff --git a/apps/s_server.c b/apps/s_server.c index ab13107e9fc..c04da1fc68b 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -1168,6 +1168,8 @@ int s_server_main(int argc, char *argv[]) case OPT_UNIX: socket_family = AF_UNIX; OPENSSL_free(host); host = OPENSSL_strdup(opt_arg()); + if (host == NULL) + goto end; OPENSSL_free(port); port = NULL; break; case OPT_UNLINK: