[PATCH] Fix fnmatch handling of collating elements (bug 17396, bug 16976)

Mike Frysinger vapier@gentoo.org
Thu Aug 18 18:04:00 GMT 2016


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160818/f7c0e44c/attachment.sig>


More information about the Libc-alpha mailing list