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

