Prefer constant division over multiplication for length checks

This commit is contained in:
akallabeth
2021-09-21 08:01:51 +02:00
committed by akallabeth
parent 6547db2f17
commit 7b7e2d6f32
16 changed files with 31 additions and 29 deletions

View File

@@ -100,7 +100,7 @@ static UINT encomsp_read_unicode_string(wStream* s, ENCOMSP_UNICODE_STRING* str)
return ERROR_INVALID_DATA;
}
if (Stream_GetRemainingLength(s) < (size_t)(str->cchString * 2))
if (Stream_GetRemainingLength(s) / sizeof(WCHAR) < str->cchString)
{
WLog_ERR(TAG, "Not enough data!");
return ERROR_INVALID_DATA;