[ldapvi] [PATCH v2 1/2] Cast the trailing NULL on execl() calls
Anders Kaseorg
andersk at MIT.EDU
Sat Apr 28 00:43:06 CEST 2012
Any update on these three patches?
http://lists.askja.de/pipermail/ldapvi/2010-December/000085.html
http://lists.askja.de/pipermail/ldapvi/2010-December/000086.html
http://lists.askja.de/pipermail/ldapvi/2010-December/000087.html
Anders
On 12/14/2010 05:15 PM, Anders Kaseorg wrote:
> 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 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/ldapvi/misc.c b/ldapvi/misc.c
> index 3b6896e..e9a0d4c 100644
> --- a/ldapvi/misc.c
> +++ b/ldapvi/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();
> }
>
More information about the ldapvi
mailing list