Skip to content

Commit

Permalink
Fix length checks in parallel driver
Browse files Browse the repository at this point in the history
The length requested was not checked against the length read from
the port.
  • Loading branch information
akallabeth committed Oct 6, 2022
1 parent 229e047 commit 094cc5a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion channels/parallel/client/parallel_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static UINT parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
return ERROR_INVALID_DATA;
Stream_Read_UINT32(irp->input, Length);
Stream_Read_UINT64(irp->input, Offset);
buffer = (BYTE*)malloc(Length);
buffer = (BYTE*)calloc(Length, sizeof(BYTE));

if (!buffer)
{
Expand All @@ -176,6 +176,7 @@ static UINT parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
}
else
{
Length = status;
}

Stream_Write_UINT32(irp->output, Length);
Expand Down

0 comments on commit 094cc5a

Please sign in to comment.