From a6a2dd9f60b3f3e93de1337ee84f9e8f33bc86a8 Mon Sep 17 00:00:00 2001 From: Jiasheng Jiang Date: Fri, 17 Jun 2022 17:44:24 +0800 Subject: [PATCH] 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) --- apps/s_server.c | 2 ++ 1 file changed, 2 insertions(+) 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: -- 2.47.2