This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] elf: Check for empty tokens before dynamic string token expansion [BZ #22625]
- From: Andreas Schwab <schwab at suse dot de>
- To: Aurelien Jarno <aurelien at aurel32 dot net>
- Cc: libc-alpha at sourceware dot org, "Dmitry V . Levin" <ldv at altlinux dot org>
- Date: Tue, 19 Dec 2017 11:59:45 +0100
- Subject: Re: [PATCH v2] elf: Check for empty tokens before dynamic string token expansion [BZ #22625]
- Authentication-results: sourceware.org; auth=none
- References: <20171218204213.26583-1-aurelien@aurel32.net>
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."