[hurd,commited] hurd: Fix spawni adding . to PATH [BZ #34932]

Samuel Thibault samuel.thibault@gnu.org
Tue Nov 3 10:40:30 GMT 2026


Florian Weimer, le mar. 03 nov. 2026 11:33:13 +0100, a ecrit:
> * 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?

I don't know, 1eb893060870 didn't mark it so. Actually the commit log
didn't even mention the removal of '.'

> The contents of the current directory might be untrusted.

Samuel


More information about the Libc-alpha mailing list