From f91d33e38c77ac65040febeee00522abf4f33309 Mon Sep 17 00:00:00 2001 From: gpotter2 <10530980+gpotter2@users.noreply.github.com> Date: Sun, 5 Jan 2025 05:48:55 +0100 Subject: [PATCH] Fix return value of update_check_flush --- libfreerdp/core/update.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libfreerdp/core/update.c b/libfreerdp/core/update.c index 0a6de5908..2be53368c 100644 --- a/libfreerdp/core/update.c +++ b/libfreerdp/core/update.c @@ -1079,19 +1079,20 @@ static BOOL update_check_flush(rdpContext* context, size_t size) wStream* s = update->us; - if (!update->us) + if (!s) { - update_begin_paint(&update->common); - return FALSE; + if (!update_begin_paint(&update->common)) + return FALSE; + s = update->us; } - if (Stream_GetPosition(s) + size + 64 >= 0x3FFF) + if (Stream_GetPosition(s) + size + 64 >= FASTPATH_MAX_PACKET_SIZE) { + // Too big for the current packet. Flush first update_flush(context); - return TRUE; } - return FALSE; + return TRUE; } static BOOL update_set_bounds(rdpContext* context, const rdpBounds* bounds)