]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps/s_server.c: Add check for OPENSSL_strdup
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Fri, 17 Jun 2022 09:44:24 +0000 (17:44 +0800)
committerPauli <pauli@openssl.org>
Wed, 22 Jun 2022 06:56:40 +0000 (16:56 +1000)
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)

apps/s_server.c

index ab13107e9fc5aede36d3350ad5a83f0474c06eba..c04da1fc68bbea68b408b1f380079af6c613cc69 100644 (file)
@@ -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: