[PATCH 1/2] posix: execvpe cleanup
Paul Eggert
eggert@cs.ucla.edu
Mon Jan 25 16:52:00 GMT 2016
On 01/25/2016 06:24 AM, Adhemerval Zanella wrote:
> -scripts_argv (const char *file, char *const argv[], int argc, char **new_argv)
> +maybe_script_execute (const char *path, char *const argv[], char *const envp[])
Why change the arg name from "file" to "path"? The GNU tradition is to
use names like "path" for PATH and the like, not for file names that may
contain slashes.
> + int argc = 0;
> + while (argv[argc++]);
Please don't format 'while' loops that way. Use 'continue;'. Also, what
happens if argc exceeds INT_MAX?
> /* Construct an argument list for the shell. */
> + char *new_argv[argc];
Why can't this overflow the stack when ARGC is large? The original code
tried to check for this overflow and do the right thing; why remove the
check, flawed as it was?
More information about the Libc-alpha
mailing list