[warnings] fix integer narrowing

This commit is contained in:
akallabeth 2024-10-03 13:15:24 +02:00
parent 69b9f81c29
commit eea56dcf60
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

View File

@ -972,8 +972,10 @@ static SSIZE_T rdstls_parse_pdu_data_type(wLog* log, UINT16 dataType, wStream* s
return 0;
Stream_Read_UINT16(s, passwordLength);
return Stream_GetPosition(s) + passwordLength;
if (!Stream_SafeSeek(s, passwordLength))
return 0;
}
break;
case RDSTLS_DATA_AUTORECONNECT_COOKIE:
{
if (Stream_GetRemainingLength(s) < 4)
@ -984,13 +986,19 @@ static SSIZE_T rdstls_parse_pdu_data_type(wLog* log, UINT16 dataType, wStream* s
if (Stream_GetRemainingLength(s) < 2)
return 0;
Stream_Read_UINT16(s, cookieLength);
return 12u + cookieLength;
if (!Stream_SafeSeek(s, cookieLength))
return 0;
}
break;
default:
WLog_Print(log, WLOG_ERROR, "invalid RDSLTS dataType");
return -1;
}
const size_t len = Stream_GetPosition(s);
if (len > SSIZE_MAX)
return 0;
return (SSIZE_T)len;
}
SSIZE_T rdstls_parse_pdu(wLog* log, wStream* stream)