[core,tpkt] log too large tpkt stream length

This commit is contained in:
akallabeth 2024-01-11 11:13:34 +01:00 committed by Martin Fleisz
parent d5eecda8a3
commit 55f200f1b5
2 changed files with 8 additions and 2 deletions

View File

@ -132,8 +132,14 @@ BOOL tpkt_read_header(wStream* s, UINT16* length)
return TRUE;
}
BOOL tpkt_ensure_stream_consumed_(wStream* s, UINT16 length, const char* fkt)
BOOL tpkt_ensure_stream_consumed_(wStream* s, size_t length, const char* fkt)
{
if (length > UINT16_MAX)
{
WLog_ERR(TAG, "[%s] length %" PRIuz " > %" PRIu16, fkt, length, UINT16_MAX);
return FALSE;
}
size_t rem = Stream_GetRemainingLength(s);
if (rem > 0)
{

View File

@ -32,6 +32,6 @@ FREERDP_LOCAL int tpkt_verify_header(wStream* s);
FREERDP_LOCAL BOOL tpkt_read_header(wStream* s, UINT16* length);
FREERDP_LOCAL BOOL tpkt_write_header(wStream* s, UINT16 length);
#define tpkt_ensure_stream_consumed(s, length) tpkt_ensure_stream_consumed_((s), (length), __func__)
FREERDP_LOCAL BOOL tpkt_ensure_stream_consumed_(wStream* s, UINT16 length, const char* fkt);
FREERDP_LOCAL BOOL tpkt_ensure_stream_consumed_(wStream* s, size_t length, const char* fkt);
#endif /* FREERDP_LIB_CORE_TPKT_H */