From 43cb13585dfa43877add92c689a9b62f486d5d60 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 16 Jan 2013 01:14:03 +0100 Subject: [PATCH] always initialize lpMultiByteStr parameter when calling ConvertFromUnicode --- channels/cliprdr/client/cliprdr_format.c | 1 + channels/drive/client/drive_file.c | 2 +- channels/drive/client/drive_main.c | 2 +- channels/parallel/client/parallel_main.c | 2 +- channels/serial/client/serial_main.c | 2 +- libfreerdp/core/gcc.c | 3 ++- libfreerdp/core/timezone.c | 3 ++- libfreerdp/rail/window.c | 3 +++ 8 files changed, 12 insertions(+), 6 deletions(-) diff --git a/channels/cliprdr/client/cliprdr_format.c b/channels/cliprdr/client/cliprdr_format.c index 7f368537e..2c6db2308 100644 --- a/channels/cliprdr/client/cliprdr_format.c +++ b/channels/cliprdr/client/cliprdr_format.c @@ -144,6 +144,7 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, UINT3 } else { + format_name->name = NULL; format_name->length = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) s->p, 32 / 2, &format_name->name, 0, NULL, NULL); } diff --git a/channels/drive/client/drive_file.c b/channels/drive/client/drive_file.c index 78701f8fd..4d4e6e8dd 100644 --- a/channels/drive/client/drive_file.c +++ b/channels/drive/client/drive_file.c @@ -430,7 +430,7 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, S BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, STREAM* input) { - char* s; + char* s = NULL; mode_t m; UINT64 size; int status; diff --git a/channels/drive/client/drive_main.c b/channels/drive/client/drive_main.c index 7571297e8..f6f48554c 100644 --- a/channels/drive/client/drive_main.c +++ b/channels/drive/client/drive_main.c @@ -471,7 +471,7 @@ static void drive_process_irp_query_volume_information(DRIVE_DEVICE* disk, IRP* static void drive_process_irp_query_directory(DRIVE_DEVICE* disk, IRP* irp) { - char* path; + char* path = NULL; int status; DRIVE_FILE* file; BYTE InitialQuery; diff --git a/channels/parallel/client/parallel_main.c b/channels/parallel/client/parallel_main.c index 3f1e06ccc..9ac56a8ca 100644 --- a/channels/parallel/client/parallel_main.c +++ b/channels/parallel/client/parallel_main.c @@ -72,7 +72,7 @@ typedef struct _PARALLEL_DEVICE PARALLEL_DEVICE; static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp) { - char* path; + char* path = NULL; int status; UINT32 PathLength; diff --git a/channels/serial/client/serial_main.c b/channels/serial/client/serial_main.c index c882cb7a1..83694bdee 100644 --- a/channels/serial/client/serial_main.c +++ b/channels/serial/client/serial_main.c @@ -79,7 +79,7 @@ static BOOL serial_check_fds(SERIAL_DEVICE* serial); static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp) { - char* path; + char* path = NULL; int status; SERIAL_TTY* tty; UINT32 PathLength; diff --git a/libfreerdp/core/gcc.c b/libfreerdp/core/gcc.c index 4d9131af4..1a761e4be 100644 --- a/libfreerdp/core/gcc.c +++ b/libfreerdp/core/gcc.c @@ -488,7 +488,7 @@ void gcc_write_user_data_header(STREAM* s, UINT16 type, UINT16 length) BOOL gcc_read_client_core_data(STREAM* s, rdpSettings* settings, UINT16 blockLength) { - char* str; + char* str = NULL; UINT32 version; UINT32 color_depth; UINT16 colorDepth = 0; @@ -518,6 +518,7 @@ BOOL gcc_read_client_core_data(STREAM* s, rdpSettings* settings, UINT16 blockLen sprintf_s(settings->ClientHostname, 31, "%s", str); settings->ClientHostname[31] = 0; free(str); + str = NULL; stream_read_UINT32(s, settings->KeyboardType); /* KeyboardType */ stream_read_UINT32(s, settings->KeyboardSubType); /* KeyboardSubType */ diff --git a/libfreerdp/core/timezone.c b/libfreerdp/core/timezone.c index 958b0c8ab..f5cb0b46c 100644 --- a/libfreerdp/core/timezone.c +++ b/libfreerdp/core/timezone.c @@ -76,7 +76,7 @@ void rdp_write_system_time(STREAM* s, SYSTEM_TIME* system_time) BOOL rdp_read_client_time_zone(STREAM* s, rdpSettings* settings) { - char* str; + char* str = NULL; TIME_ZONE_INFO* clientTimeZone; if (stream_get_left(s) < 172) @@ -91,6 +91,7 @@ BOOL rdp_read_client_time_zone(STREAM* s, rdpSettings* settings) stream_seek(s, 64); strncpy(clientTimeZone->standardName, str, sizeof(clientTimeZone->standardName)); free(str); + str = NULL; rdp_read_system_time(s, &clientTimeZone->standardDate); /* StandardDate */ stream_read_UINT32(s, clientTimeZone->standardBias); /* StandardBias */ diff --git a/libfreerdp/rail/window.c b/libfreerdp/rail/window.c index 7819beafb..35a55e3b7 100644 --- a/libfreerdp/rail/window.c +++ b/libfreerdp/rail/window.c @@ -325,7 +325,10 @@ void rail_UpdateWindow(rdpRail* rail, rdpWindow* window) if (window->fieldFlags & WINDOW_ORDER_FIELD_TITLE) { if (window->title != NULL) + { free(window->title); + window->title = NULL; + } ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) window->titleInfo.string, window->titleInfo.length / 2, &window->title, 0, NULL, NULL);