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] elf: Check for empty tokens before dynamic string token expansion [BZ #22625]


On Dez 18 2017, Aurelien Jarno <aurelien@aurel32.net> wrote:

> @@ -433,22 +443,33 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
>  {
>    char *cp;
>    size_t nelems = 0;
> -  char *to_free;
>  
>    while ((cp = __strsep (&rpath, sep)) != NULL)
>      {
>        struct r_search_path_elem *dirp;
> -
> -      to_free = cp = expand_dynamic_string_token (l, cp, 1);
> -
> -      size_t len = strlen (cp);
> +      char *to_free = NULL;
> +      size_t len;
>  
>        /* `strsep' can pass an empty string.  This has to be
>  	 interpreted as `use the current directory'. */
> -      if (len == 0)
> +      if (*cp == '\0')
>  	{
>  	  static const char curwd[] = "./";
>  	  cp = (char *) curwd;
> +	  len = 0;
> +	}

I wonder why we need curwd at all.  Nothing below this reads past
cp[len] anyway.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


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