From b79ce071378472a61240df4914f0a6194084b856 Mon Sep 17 00:00:00 2001 From: Zhang Zhaolong Date: Thu, 21 Nov 2013 13:28:54 +0800 Subject: [PATCH] fix memory realloc size error. --- client/Windows/wf_cliprdr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/Windows/wf_cliprdr.c b/client/Windows/wf_cliprdr.c index 1cd11aaae..bc286d2dd 100644 --- a/client/Windows/wf_cliprdr.c +++ b/client/Windows/wf_cliprdr.c @@ -83,7 +83,7 @@ static void map_ensure_capacity(cliprdrContext *cliprdr) { if (cliprdr->map_size >= cliprdr->map_capacity) { cliprdr->format_mappings = (formatMapping *)realloc(cliprdr->format_mappings, - cliprdr->map_capacity * 2); + sizeof(formatMapping) * cliprdr->map_capacity * 2); cliprdr->map_capacity *= 2; } } @@ -475,6 +475,7 @@ static void wf_cliprdr_process_cb_format_list_event(wfContext *wfc, RDP_CB_FORMA map = &cliprdr->format_mappings[i++]; Read_UINT32(p, map->remote_format_id); + map->name = NULL; /* get name_len */ for (tmp = p, name_len = 0; tmp + 1 < end_mark; tmp += 2, name_len += 2) { @@ -508,6 +509,7 @@ static void wf_cliprdr_process_cb_format_list_event(wfContext *wfc, RDP_CB_FORMA map = &cliprdr->format_mappings[i++]; Read_UINT32(p, map->remote_format_id); + map->name = NULL; if (event->raw_format_unicode) { /* get name_len, in bytes, if the file name is truncated, no terminated null will be included. */