Fixed int overflow in msusb_mspipes_read

Thanks to hac425
This commit is contained in:
akallabeth 2020-04-29 15:49:52 +02:00
parent 8e9b0a625b
commit 9f77fc3dd2

View File

@ -64,7 +64,7 @@ static MSUSB_PIPE_DESCRIPTOR** msusb_mspipes_read(wStream* s, UINT32 NumberOfPip
UINT32 pnum;
MSUSB_PIPE_DESCRIPTOR** MsPipes;
if (Stream_GetRemainingCapacity(s) < 12 * NumberOfPipes)
if (Stream_GetRemainingCapacity(s) / 12 < NumberOfPipes)
return NULL;
MsPipes = (MSUSB_PIPE_DESCRIPTOR**)calloc(NumberOfPipes, sizeof(MSUSB_PIPE_DESCRIPTOR*));