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 v2 1/2] posix: execvpe cleanup


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?


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