From: Todd C. Miller Date: Fri, 12 Sep 2008 13:34:27 +0000 (+0000) Subject: Redo change in 1.34 to use pointer arithmetic. X-Git-Tag: SUDO_1_7_0~89 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65bce6555173c09651090debca4253f1d627d55f;p=sudo Redo change in 1.34 to use pointer arithmetic. --- diff --git a/match.c b/match.c index 3aa153c62..e62513ac6 100644 --- a/match.c +++ b/match.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1998-2005, 2008 + * Copyright (c) 1996, 1998-2005, 2007-2008 * Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any @@ -370,10 +370,9 @@ command_matches(sudoers_cmnd, sudoers_args) { struct stat sudoers_stat; struct dirent *dent; - char *cp, *base, buf[PATH_MAX]; + char **ap, *base, buf[PATH_MAX], *cp; glob_t gl; DIR *dirp; - int i; /* Check for pseudo-commands */ if (strchr(user_cmnd, '/') == NULL) { @@ -415,8 +414,7 @@ command_matches(sudoers_cmnd, sudoers_args) return(FALSE); } /* For each glob match, compare basename, st_dev and st_ino. */ - i = 0; - while ((cp = gl.gl_pathv[i++])) { + for (ap = gl.gl_pathv; (cp = *ap) != NULL; ap++) { /* only stat if basenames are the same */ if ((base = strrchr(cp, '/')) != NULL) base++;