From 88d9b1f110405367631b4e96fecfac789a91fcbd Mon Sep 17 00:00:00 2001 From: akallabeth Date: Tue, 22 Oct 2024 15:51:44 +0200 Subject: [PATCH] [crypto,per] abort on invalid parameters --- libfreerdp/crypto/per.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libfreerdp/crypto/per.c b/libfreerdp/crypto/per.c index 55f921130..642f13598 100644 --- a/libfreerdp/crypto/per.c +++ b/libfreerdp/crypto/per.c @@ -333,6 +333,8 @@ BOOL per_read_integer16(wStream* s, UINT16* integer, UINT16 min) BOOL per_write_integer16(wStream* s, UINT16 integer, UINT16 min) { + if (min > integer) + return FALSE; if (!Stream_EnsureRemainingCapacity(s, 2)) return FALSE; Stream_Write_UINT16_BE(s, integer - min);