From 1a11f129abb1115e622354a963c61bda1841de95 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Mon, 18 May 2020 08:10:29 +0200 Subject: [PATCH] Fixed unaligned access (cherry picked from commit cb2ed7f09ad68242bfdfad8967024b063f785d97) --- libfreerdp/core/info.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libfreerdp/core/info.c b/libfreerdp/core/info.c index 5421ee8..fc99b91 100644 --- a/libfreerdp/core/info.c +++ b/libfreerdp/core/info.c @@ -285,7 +285,8 @@ static BOOL rdp_read_extended_info_packet(rdpRdp* rdp, wStream* s) { ptrconv.bp = Stream_Pointer(s); - if (ptrconv.wp[cbClientAddress / 2 - 1]) + if ((cbClientAddress < sizeof(WCHAR)) || (ptrconv.bp[cbClientAddress - 1]) || + (ptrconv.bp[cbClientAddress - 2])) { WLog_ERR(TAG, "protocol error: clientAddress must be null terminated"); return FALSE; @@ -334,7 +335,8 @@ static BOOL rdp_read_extended_info_packet(rdpRdp* rdp, wStream* s) { ptrconv.bp = Stream_Pointer(s); - if (ptrconv.wp[cbClientDir / 2 - 1]) + if ((cbClientDir < sizeof(WCHAR)) || (ptrconv.bp[cbClientDir - 1]) || + (ptrconv.bp[cbClientDir - 2])) { WLog_ERR(TAG, "protocol error: clientDir must be null terminated"); return FALSE; -- 2.7.4