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

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