48 lines
1.4 KiB
Diff
48 lines
1.4 KiB
Diff
From 45eb952b12e95dfe72e0994976d2ec2714fd193a Mon Sep 17 00:00:00 2001
|
|
From: John Thacker <johnthacker@gmail.com>
|
|
Date: Mon, 23 Mar 2026 13:02:49 +0000
|
|
Subject: [PATCH] RDP: Check for too long segments on the uncompressed path
|
|
|
|
The RDP 8.0 compression limits the maximum number of uncompressed
|
|
bytes in a single segment to 65,535 [MS-RDPEGFX] 3.1.9.1.2.
|
|
Check for that in the uncompressed path.
|
|
|
|
Fix #21105
|
|
|
|
AI-Assisted: no
|
|
|
|
|
|
(cherry picked from commit 87fb30a03d19bb2a0c8597e10c38f1657310fafd)
|
|
|
|
Co-authored-by: John Thacker <johnthacker@gmail.com>
|
|
---
|
|
epan/tvbuff_rdp.c | 6 +++++-
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/epan/tvbuff_rdp.c b/epan/tvbuff_rdp.c
|
|
index 948ec1cf2d6..2cfb89b1e2a 100644
|
|
--- a/epan/tvbuff_rdp.c
|
|
+++ b/epan/tvbuff_rdp.c
|
|
@@ -157,7 +157,8 @@ static const zgfx_token_t ZGFX_MATCH_TABLE[] = {
|
|
{ 9, 382, 24, 17094304 }, // 101111110
|
|
};
|
|
|
|
-
|
|
+/* Limits from [MS-RDPEGFX] 3.1.9.1.2 (So failures here are malformed
|
|
+ * packets, not limitations of the implementation.) */
|
|
struct _zgfx_context_t{
|
|
uint8_t historyBuffer[2500000];
|
|
uint32_t historyIndex;
|
|
@@ -338,6 +339,9 @@ rdp8_decompress_segment(zgfx_context_t *zgfx, tvbuff_t *tvb)
|
|
len--;
|
|
|
|
if (!(flags & ZGX_PACKET_COMPRESSED)) {
|
|
+ if (len > 65535) {
|
|
+ return false;
|
|
+ }
|
|
tvbuff_t *raw = tvb_new_subset_remaining(tvb, 1);
|
|
zgfx_write_history_buffer_tvb(zgfx, raw, len);
|
|
|
|
--
|
|
GitLab
|
|
|