This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH v2 1/2] posix: execvpe cleanup
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, libc-alpha at sourceware dot org
- Date: Wed, 27 Jan 2016 08:17:36 -0800
- Subject: Re: [PATCH v2 1/2] posix: execvpe cleanup
- Authentication-results: sourceware.org; auth=none
- References: <1453897925-3643-1-git-send-email-adhemerval dot zanella at linaro dot org>
Adhemerval Zanella wrote:
+ int argc = 0;
+ while (argv[argc++])
+ if (argc > NCARGS)
This won't work on platforms where NCARGS is INT_MAX.
+ char *new_argv[argc];
This can allocate up to NCARGS * sizeof (char *) bytes on the stack, which is
too much. I suggest allocating on the stack only if __libc_use_alloca says it's OK.
+ size_t path_len = __strnlen (path, PATH_MAX - 1) + 1;
What about platforms that don't define PATH_MAX because there's no limit? Or
what if PATH_MAX is larger than what __libc_use_alloca would allow?