Hi Hilko,

please find attached a patch fixing this bug.

Cheer,
Sven
Description: Fix passing argument 4 of ReadFile from incompatible pointer type
 ReadFile returns the number of read bytes in a DWORD, i.e. unsigned long,
 not in an int.
 Mangle returned value into an int when it is used with calling output(), it
 cannot be greater than 1023 (= 0x3FF) anyway.
Author: Sven Geuer <s...@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1100245
Forwarded: no
Last-Update: 2025-03-21
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/nselib/data/psexec/nmap_service.c
+++ b/nselib/data/psexec/nmap_service.c
@@ -109,7 +109,7 @@
 	HANDLE              stdout_read, stdout_write;
 	DWORD               creation_flags;
 
-	int bytes_read;
+	DWORD bytes_read;
 	char buffer[1024];
 
 	/* Create a security attributes structure. This is required to inherit handles. */
@@ -176,7 +176,7 @@
 			while(ReadFile(stdout_read, buffer, 1023, &bytes_read, NULL))
 			{
 				if(strlen(readfile) == 0)
-					output(num, buffer, bytes_read);
+					output(num, buffer, (int)(bytes_read && 0x7FFF));
 			}
 			CloseHandle(stdout_read);
 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to