void-packages/srcpkgs/ldapvi/patches/Cast-the-trailing-NULL-on-execl-calls.patch
Đoàn Trần Công Danh 861ac185a6 srcpkgs/l*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

54 lines
1.3 KiB
Diff

From 33d23689ea0551e3df8227fe8da941e14586728c Mon Sep 17 00:00:00 2001
From: Anders Kaseorg <andersk@MIT.EDU>
Date: Tue, 14 Dec 2010 17:15:46 -0500
Subject: [PATCH] Cast the trailing NULL on execl() calls
From exec(3): ?The list of arguments must be terminated by a NULL
pointer, and, since these are variadic functions, this pointer must be
cast (char *) NULL.?
This prevents crashes on 64-bit systems, where 0 is a 32-bit integer
and (char *) NULL is a 64-bit pointer.
Signed-off-by: Anders Kaseorg <andersk at mit.edu>
---
ldapvi/misc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ldapvi/misc.c b/ldapvi/misc.c
index 3b6896e..e9a0d4c 100644
--- a/misc.c
+++ b/misc.c
@@ -172,9 +172,9 @@ edit(char *pathname, long line)
if (line > 0) {
char buf[20];
snprintf(buf, 20, "+%ld", line);
- execlp(vi, vi, buf, pathname, 0);
+ execlp(vi, vi, buf, pathname, (char *) NULL);
} else
- execlp(vi, vi, pathname, 0);
+ execlp(vi, vi, pathname, (char *) NULL);
syserr();
}
@@ -213,7 +213,7 @@ view(char *pathname)
case -1:
syserr();
case 0:
- execlp(pg, pg, pathname, 0);
+ execlp(pg, pg, pathname, (char *) NULL);
syserr();
}
@@ -245,7 +245,7 @@ pipeview(int *fd)
close(fds[1]);
dup2(fds[0], 0);
close(fds[0]);
- execlp(pg, pg, 0);
+ execlp(pg, pg, (char *) NULL);
syserr();
}
--
2.8.3