libfreerdp-client: fix possible infinite loop with .rdp file parsing containing freerdp options

This commit is contained in:
Marc-André Moreau
2013-11-10 13:29:20 -05:00
parent 4898868e9d
commit fb23f08388
4 changed files with 19 additions and 6 deletions

View File

@@ -989,7 +989,7 @@ BOOL freerdp_client_detect_command_line(int argc, char** argv, DWORD* flags)
*flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
*flags |= COMMAND_LINE_SIGIL_ENABLE_DISABLE;
if (windows_cli_count > posix_cli_count)
if (windows_cli_count >= posix_cli_count)
{
*flags = COMMAND_LINE_SEPARATOR_COLON;
*flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS;
@@ -1098,7 +1098,6 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
return status;
}
arg = CommandLineFindArgumentA(args, "v");
arg = args;

View File

@@ -199,7 +199,12 @@ int freerdp_client_old_command_line_pre_filter(void* context, int index, int arg
{
return -1;
}
freerdp_client_old_parse_hostname((char*) argv[index], &settings->ServerHostname, &settings->ServerPort);
if (settings)
{
freerdp_client_old_parse_hostname((char*) argv[index],
&settings->ServerHostname, &settings->ServerPort);
}
}
else
{
@@ -280,14 +285,19 @@ int freerdp_client_old_command_line_pre_filter(void* context, int index, int arg
index++;
i++;
}
} else {
}
else
{
if (settings)
{
if (settings->instance)
{
freerdp_client_old_process_plugin(settings, args);
}
}
}
for (i=0; i<args->argc; i++)
for (i = 0; i < args->argc; i++)
free(args->argv[i]);
free(args->argv);
free(args);

View File

@@ -976,7 +976,11 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
if (file->argc > 1)
{
char* ConnectionFile = settings->ConnectionFile;
settings->ConnectionFile = NULL;
freerdp_client_settings_parse_command_line(settings, file->argc, file->argv);
settings->ConnectionFile = ConnectionFile;
}
return TRUE;

View File

@@ -53,7 +53,7 @@
#define COMMAND_LINE_SIGIL_DOUBLE_DASH 0x00000008
#define COMMAND_LINE_SIGIL_PLUS_MINUS 0x00000010
#define COMMAND_LINE_SIGIL_ENABLE_DISABLE 0x00000020
#define COMMAND_LINE_SIGIL_NOT_ESCAPED 0x00000040
#define COMMAND_LINE_SIGIL_NOT_ESCAPED 0x00000040
#define COMMAND_LINE_SEPARATOR_COLON 0x00000100
#define COMMAND_LINE_SEPARATOR_EQUAL 0x00000200