File: upstream-Fix-incompatible-pointer-type-error.patch

package info (click to toggle)
nmap 7.98%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 45,872 kB
  • sloc: cpp: 61,855; ansic: 31,545; python: 17,238; sh: 15,622; xml: 11,564; perl: 2,650; makefile: 966; java: 45; objc: 45
file content (39 lines) | stat: -rw-r--r-- 1,508 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From: Sven Geuer <sge@debian.org>
Date: Wed, 29 Oct 2025 19:31:11 +0000
Subject: Fix passing argument 4 of ReadFile from incompatible pointer type

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1100245
Forwarded: https://github.com/nmap/nmap/pull/3070
Last-Update: 2025-03-28

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.
Last-Update: 2025-03-28
---
 nselib/data/psexec/nmap_service.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nselib/data/psexec/nmap_service.c b/nselib/data/psexec/nmap_service.c
index a6a563b..fc94930 100644
--- a/nselib/data/psexec/nmap_service.c
+++ b/nselib/data/psexec/nmap_service.c
@@ -109,7 +109,7 @@ static void go(int num, char *lpAppPath, char *env, int headless, int include_st
 	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 @@ static void go(int num, char *lpAppPath, char *env, int headless, int include_st
 			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);