Blame SOURCES/Fix-length-checks-in-parallel-driver.patch

087af1
From 64544c7f4ed72b3023955ebe6ad3b118ebb8d6c7 Mon Sep 17 00:00:00 2001
087af1
From: akallabeth <akallabeth@posteo.net>
087af1
Date: Thu, 6 Oct 2022 09:12:40 +0200
087af1
Subject: [PATCH] Fix length checks in parallel driver
087af1
087af1
The length requested was not checked against the length read from
087af1
the port.
087af1
087af1
(cherry picked from commit 094cc5a4596c299595b732effd59ee149181fd61)
087af1
---
087af1
 channels/parallel/client/parallel_main.c | 3 ++-
087af1
 1 file changed, 2 insertions(+), 1 deletion(-)
087af1
087af1
diff --git a/channels/parallel/client/parallel_main.c b/channels/parallel/client/parallel_main.c
087af1
index af3e82703..993605a65 100644
087af1
--- a/channels/parallel/client/parallel_main.c
087af1
+++ b/channels/parallel/client/parallel_main.c
087af1
@@ -159,7 +159,7 @@ static UINT parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
087af1
 		return ERROR_INVALID_DATA;
087af1
 	Stream_Read_UINT32(irp->input, Length);
087af1
 	Stream_Read_UINT64(irp->input, Offset);
087af1
-	buffer = (BYTE*)malloc(Length);
087af1
+	buffer = (BYTE*)calloc(Length, sizeof(BYTE));
087af1
 
087af1
 	if (!buffer)
087af1
 	{
087af1
@@ -178,6 +178,7 @@ static UINT parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
087af1
 	}
087af1
 	else
087af1
 	{
087af1
+		Length = status;
087af1
 	}
087af1
 
087af1
 	Stream_Write_UINT32(irp->output, Length);
087af1
-- 
087af1
2.37.1
087af1