summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiasheng Jiang <jiasheng@iscas.ac.cn>2022-06-17 17:44:24 +0800
committerPauli <pauli@openssl.org>2022-06-22 16:57:17 +1000
commit3ec2baf41dd6a414347f1ff6c7cec6a996e0afe1 (patch)
treeb1c9e7c6c88a8cb846d5cda20cd277e0bd9ed053
parent2814834bf2f4e7923294326b0251c3a6579b1312 (diff)
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 <jiasheng@iscas.ac.cn> Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18595) (cherry picked from commit a6a2dd9f60b3f3e93de1337ee84f9e8f33bc86a8)
-rw-r--r--apps/s_server.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/apps/s_server.c b/apps/s_server.c
index 45b2552d56..cfd3deb1be 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -1160,6 +1160,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: