From 36a1323dceb0690d5422a809d51072d079cdc8f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benoi=CC=82t=20LeBlanc?= Date: Fri, 13 Dec 2013 16:58:46 -0500 Subject: [PATCH] fixed error parsing rdp file: lines without value were ignored before being marked as formatted, resulting in duplicate values being written to the RDP file afterwards. --- client/common/file.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/client/common/file.c b/client/common/file.c index 96fdfe446..acac04acb 100644 --- a/client/common/file.c +++ b/client/common/file.c @@ -49,7 +49,7 @@ static WCHAR CR_LF_STR_W[] = { '\r', '\n', '\0' }; #define INVALID_INTEGER_VALUE 0xFFFFFFFF -BOOL freerdp_client_rdp_file_set_integer(rdpFile* file, char* name, int value, int index) +BOOL freerdp_client_rdp_file_set_integer(rdpFile* file, const char* name, int value, int index) { BOOL bStandard = TRUE; @@ -229,13 +229,13 @@ void freerdp_client_parse_rdp_file_integer_unicode(rdpFile* file, WCHAR* name, W free(valueA); } -void freerdp_client_parse_rdp_file_integer_ascii(rdpFile* file, char* name, char* value, int index) +void freerdp_client_parse_rdp_file_integer_ascii(rdpFile* file, const char* name, const char* value, int index) { int ivalue = atoi(value); freerdp_client_rdp_file_set_integer(file, name, ivalue, index); } -BOOL freerdp_client_rdp_file_set_string(rdpFile* file, char* name, char* value, int index) +BOOL freerdp_client_rdp_file_set_string(rdpFile* file, const char* name, const char* value, int index) { BOOL bStandard = TRUE; @@ -436,8 +436,6 @@ BOOL freerdp_client_parse_rdp_file_buffer_ascii(rdpFile* file, const BYTE* buffe if ((d2 - d1) != 2) goto next_line; /* improper type length */ - if (d2 == end) - goto next_line; /* no value */ *d1 = 0; *d2 = 0; @@ -514,8 +512,6 @@ BOOL freerdp_client_parse_rdp_file_buffer_unicode(rdpFile* file, const BYTE* buf if ((d2 - d1) != 2) goto next_line; /* improper type length */ - if (d2 == end) - goto next_line; /* no value */ *d1 = 0; *d2 = 0; @@ -1067,7 +1063,7 @@ int freerdp_client_rdp_file_set_string_option(rdpFile* file, const char* name, c index = freerdp_client_parse_rdp_file_add_line(file, text, -1); line = freerdp_client_rdp_file_find_line_index(file, index); - freerdp_client_rdp_file_set_string(file, (char*) name, (char*) value, index); + freerdp_client_rdp_file_set_string(file, name, value, index); free(text); }