From f676c48a2f406a1a1d2256102f7f165f861c3b5f Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Sun, 7 Dec 2014 00:21:28 +0100 Subject: [PATCH 1/8] Fixed broken NULL pointer check. --- winpr/libwinpr/utils/wlog/CallbackAppender.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winpr/libwinpr/utils/wlog/CallbackAppender.c b/winpr/libwinpr/utils/wlog/CallbackAppender.c index 1e6a60792..82ff5a3ea 100644 --- a/winpr/libwinpr/utils/wlog/CallbackAppender.c +++ b/winpr/libwinpr/utils/wlog/CallbackAppender.c @@ -109,7 +109,7 @@ int WLog_CallbackAppender_WriteImageMessage(wLog* log, wLogCallbackAppender* app int WLog_CallbackAppender_WritePacketMessage(wLog* log, wLogCallbackAppender* appender, wLogMessage* message) { - if (!appender->package) + if (appender->package) { appender->package(message); } From 547054a48b83fe81917cb3b474116225e97d340f Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Sun, 7 Dec 2014 00:23:46 +0100 Subject: [PATCH 2/8] Fixed uninitialized value. --- server/shadow/shadow_subsystem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/shadow/shadow_subsystem.c b/server/shadow/shadow_subsystem.c index f0ed9b85b..ac4fd70ce 100644 --- a/server/shadow/shadow_subsystem.c +++ b/server/shadow/shadow_subsystem.c @@ -93,11 +93,11 @@ int shadow_subsystem_load_entry_points(RDP_SHADOW_ENTRY_POINTS* pEntryPoints, co entry = shadow_subsystem_load_static_entry(name); + ZeroMemory(pEntryPoints, sizeof(RDP_SHADOW_ENTRY_POINTS)); + if (!entry) return -1; - ZeroMemory(pEntryPoints, sizeof(RDP_SHADOW_ENTRY_POINTS)); - if (entry(pEntryPoints) < 0) return -1; From b23b0c656e0b3426d5ea414340fb9b1475d44d91 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Sun, 7 Dec 2014 00:27:06 +0100 Subject: [PATCH 3/8] Fixed uninitialized values in case of error return. --- channels/rdpgfx/client/rdpgfx_codec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/channels/rdpgfx/client/rdpgfx_codec.c b/channels/rdpgfx/client/rdpgfx_codec.c index 402e85452..2b146b348 100644 --- a/channels/rdpgfx/client/rdpgfx_codec.c +++ b/channels/rdpgfx/client/rdpgfx_codec.c @@ -57,6 +57,9 @@ int rdpgfx_read_h264_metablock(RDPGFX_PLUGIN* gfx, wStream* s, RDPGFX_H264_METAB RDPGFX_RECT16* regionRect; RDPGFX_H264_QUANT_QUALITY* quantQualityVal; + meta->regionRects = NULL; + meta->quantQualityVals = NULL; + if (Stream_GetRemainingLength(s) < 4) return -1; From 23d64bd6cac7b83ccdb2532b5cf7c255016ef66f Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Sun, 7 Dec 2014 00:29:28 +0100 Subject: [PATCH 4/8] Fixed uninitialized value. --- client/X11/xf_cliprdr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index 6956d342a..9f654b25b 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -963,6 +963,7 @@ static int xf_cliprdr_server_format_data_response(CliprdrClientContext* context, } pDstData = NULL; + DstSize = 0; formatId = 0; altFormatId = 0; From 6b2790774e332f2fd707e4cc1e63e85c670873bc Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Sun, 7 Dec 2014 00:33:37 +0100 Subject: [PATCH 5/8] Fixed missing NULL pointer check. --- channels/cliprdr/client/cliprdr_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/channels/cliprdr/client/cliprdr_main.c b/channels/cliprdr/client/cliprdr_main.c index 0045e2d0a..b5e63825b 100644 --- a/channels/cliprdr/client/cliprdr_main.c +++ b/channels/cliprdr/client/cliprdr_main.c @@ -522,8 +522,10 @@ int cliprdr_client_format_list(CliprdrClientContext* context, CLIPRDR_FORMAT_LIS if (formatNameSize > 15) formatNameSize = 15; - - Stream_Write(s, wszFormatName, formatNameSize * 2); + + if (wszFormatName) + Stream_Write(s, wszFormatName, formatNameSize * 2); + Stream_Zero(s, 32 - (formatNameSize * 2)); free(wszFormatName); From 528c5841d5abdecc204965ab70d4ab17761dd007 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Sun, 7 Dec 2014 00:50:20 +0100 Subject: [PATCH 6/8] Fixed memory leak. --- libfreerdp/codec/planar.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libfreerdp/codec/planar.c b/libfreerdp/codec/planar.c index 30ae1c29f..836d81cc1 100644 --- a/libfreerdp/codec/planar.c +++ b/libfreerdp/codec/planar.c @@ -996,10 +996,10 @@ BYTE* freerdp_bitmap_planar_delta_encode_plane(BYTE* inPlane, int width, int hei int freerdp_bitmap_planar_delta_encode_planes(BYTE* inPlanes[4], int width, int height, BYTE* outPlanes[4]) { - freerdp_bitmap_planar_delta_encode_plane(inPlanes[0], width, height, outPlanes[0]); - freerdp_bitmap_planar_delta_encode_plane(inPlanes[1], width, height, outPlanes[1]); - freerdp_bitmap_planar_delta_encode_plane(inPlanes[2], width, height, outPlanes[2]); - freerdp_bitmap_planar_delta_encode_plane(inPlanes[3], width, height, outPlanes[3]); + outPlanes[0] = freerdp_bitmap_planar_delta_encode_plane(inPlanes[0], width, height, outPlanes[0]); + outPlanes[1] = freerdp_bitmap_planar_delta_encode_plane(inPlanes[1], width, height, outPlanes[1]); + outPlanes[2] = freerdp_bitmap_planar_delta_encode_plane(inPlanes[2], width, height, outPlanes[2]); + outPlanes[3] = freerdp_bitmap_planar_delta_encode_plane(inPlanes[3], width, height, outPlanes[3]); return 0; } From 8a6c4396b264d1060c06a7b609fb75316ef9f24b Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Sun, 7 Dec 2014 01:04:30 +0100 Subject: [PATCH 7/8] Fixed memory leak. --- winpr/libwinpr/thread/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/winpr/libwinpr/thread/process.c b/winpr/libwinpr/thread/process.c index 624904ab7..9d4f948d4 100644 --- a/winpr/libwinpr/thread/process.c +++ b/winpr/libwinpr/thread/process.c @@ -291,6 +291,7 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags, if (!thread) { + ProcessHandleCloseHandle(process); goto finish; } From 4d8c91b0fe5d20e067323c75fa404769c51d154d Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Sun, 7 Dec 2014 01:15:49 +0100 Subject: [PATCH 8/8] Fixed missing declarations. --- winpr/libwinpr/thread/process.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/winpr/libwinpr/thread/process.c b/winpr/libwinpr/thread/process.c index 9d4f948d4..ab2aab41d 100644 --- a/winpr/libwinpr/thread/process.c +++ b/winpr/libwinpr/thread/process.c @@ -177,7 +177,8 @@ char* FindApplicationPath(char* application) return filename; } -HANDLE CreateProcessHandle(pid_t pid); +static HANDLE CreateProcessHandle(pid_t pid); +static BOOL ProcessHandleCloseHandle(HANDLE handle); BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags, LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, @@ -457,7 +458,7 @@ BOOL TerminateProcess(HANDLE hProcess, UINT uExitCode) } -static BOOL ProcessHandleCloseHandle(HANDLE handle) +BOOL ProcessHandleCloseHandle(HANDLE handle) { WINPR_PROCESS* process = (WINPR_PROCESS*) handle; free(process);