This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] posix: execvpe cleanup


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?



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]