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] Fix fnmatch handling of collating elements (bug 17396, bug 16976)


On 16 Aug 2016 15:27, Andreas Schwab wrote:
> This fixes the same bug that was fixed by commit 7e2f0d2 for regexp
> matching.  As a side effect it also removes the use of an unbound VLA.

i scanned the fnmatch at a high level and looks OK, but might want to
see if anyone with more familiarity chimes in

> --- a/posix/Makefile
> +++ b/posix/Makefile

i was going to say you're missing $(gen-locales) deps for these tests,
but they're in there and have been since Oct 2015.  i guess you've had
this patch for a while now ? :)

> +char pattern[LENGTH + 7];

static

> +  pattern[0] = '[';
> +  pattern[1] = '[';
> +  pattern[2] = '.';
> +  memset (pattern + 3, 'a', LENGTH);
> +  pattern[LENGTH + 3] = '.';
> +  pattern[LENGTH + 4] = ']';
> +  pattern[LENGTH + 5] = ']';

might be a little more readable:
	strcpy (pattern, "[[.", 3);
	memset (pattern + 3, 'a', LENGTH);
	strcpy (pattern + LENGTH + 3, ".]]", 3);

at least, pattern isn't explicitly NUL terminated in the current test
(other than "pattern" being in the bss, but it's also missing static)
-mike

Attachment: signature.asc
Description: Digital signature


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