[client,common] fix /ipv4 /ipv6 without :force

As arg->Value is NULL when using /ipv4 or /ipv6 alone, it segfaulted
doing strncmp.
This commit is contained in:
Frederick Zhang 2024-07-05 00:04:32 +10:00
parent 8495c79dd0
commit 919a692abc
No known key found for this signature in database
GPG Key ID: 980A192C361BE1AE

View File

@ -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);