From 919a692abc9a0117805691df41f5c0596b115b15 Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Fri, 5 Jul 2024 00:04:32 +1000 Subject: [PATCH] [client,common] fix /ipv4 /ipv6 without :force As arg->Value is NULL when using /ipv4 or /ipv6 alone, it segfaulted doing strncmp. --- client/common/cmdline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 3d98f93b5..8b8190bf4 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -4600,7 +4600,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int( } CommandLineSwitchCase(arg, "ipv4") { - if (strncmp(arg->Value, "force", 6) == 0) + if (arg->Value != NULL && strncmp(arg->Value, "force", 6) == 0) { if (!freerdp_settings_set_uint32(settings, FreeRDP_ForceIPvX, 4)) return fail_at(arg, COMMAND_LINE_ERROR); @@ -4613,7 +4613,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int( } CommandLineSwitchCase(arg, "ipv6") { - if (strncmp(arg->Value, "force", 6) == 0) + if (arg->Value != NULL && strncmp(arg->Value, "force", 6) == 0) { if (!freerdp_settings_set_uint32(settings, FreeRDP_ForceIPvX, 6)) return fail_at(arg, COMMAND_LINE_ERROR);