[hurd,commited] hurd: Fix spawni adding . to PATH [BZ #34932]
Florian Weimer
fweimer@redhat.com
Tue Nov 3 10:33:13 GMT 2026
* Samuel Thibault:
> This follows the 1eb893060870 ("posix: execvpe cleanup") common execvpe
> cleanup which was not propagated to the Hurd-specific spawni.
> ---
> sysdeps/mach/hurd/spawni.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c
> index 375f763633..d9268f71cb 100644
> --- a/sysdeps/mach/hurd/spawni.c
> +++ b/sysdeps/mach/hurd/spawni.c
> @@ -19,6 +19,7 @@
> #include <errno.h>
> #include <fcntl.h>
> #include <paths.h>
> +#include <confstr.h>
> #include <spawn.h>
> #include <stdlib.h>
> #include <string.h>
> @@ -44,7 +45,8 @@ __spawni (pid_t *pid, const char *file,
> int xflags)
> {
> pid_t new_pid;
> - char *path, *p, *name;
> + const char *path, *p;
> + char *name;
> char *concat_name = NULL;
> const char *relpath, *abspath;
> int res;
> @@ -732,15 +734,7 @@ retry:
> /* We have to search for FILE on the path. */
> path = getenv ("PATH");
> if (path == NULL)
> - {
> - /* There is no `PATH' in the environment.
> - The default search path is the current directory
> - followed by the path `confstr' returns for `_CS_PATH'. */
> - len = __confstr (_CS_PATH, (char *) NULL, 0);
> - path = (char *) __alloca (1 + len);
> - path[0] = ':';
> - (void) __confstr (_CS_PATH, path + 1, len);
> - }
> + path = CS_PATH;
>
> len = strlen (file) + 1;
> pathlen = strlen (path);
Is this a security vulnerability? The contents of the current directory
might be untrusted.
Thanks,
Florian
More information about the Libc-alpha
mailing list