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

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