summary refs log tree commit diff
path: root/locale/findlocale.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-11-12 22:41:03 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-11-12 22:41:03 +0000
commit9975e3d37d8585b41db075321bade3495cf58cdb (patch)
tree416cb16185348b44feb8e0fdb778325a52598e21 /locale/findlocale.c
parentc4eae75271734f820a7477dbce33f8752af6f003 (diff)
downloadglibc-9975e3d37d8585b41db075321bade3495cf58cdb.tar.gz
glibc-9975e3d37d8585b41db075321bade3495cf58cdb.tar.xz
glibc-9975e3d37d8585b41db075321bade3495cf58cdb.zip
Fix locale memmem namespace (bug 17585).
Locale code, brought in by ISO C functions, calls memmem, which is not
an ISO C function.  This isn't an ISO C conformance bug, because all
mem* names are reserved, but glibc practice is not to rely on that
reservation (thus, memmem is only declared in string.h if __USE_GNU
even though ISO C would allow it to be declared unconditionally, for
example).  This patch changes that code to use __memmem.

Note: there are uses of memmem elsewhere in glibc that I didn't
change, although it may turn out some of those also need to use
__memmem.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by this patch).

	[BZ #17585]
	* string/memmem.c [!_LIBC] (__memmem): Define to memmem.
	(memmem): Rename to __memmem and define as weak alias of
	__memmem.  Use libc_hidden_weak.
	(__memmem): Use libc_hidden_def.
	* include/string.h (__memmem): Declare.  Use libc_hidden_proto.
	* locale/findlocale.c (valid_locale_name): Use __memmem instead of
	memmem.
Diffstat (limited to 'locale/findlocale.c')
-rw-r--r--locale/findlocale.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/locale/findlocale.c b/locale/findlocale.c
index 22e8b53032..b64352c9d9 100644
--- a/locale/findlocale.c
+++ b/locale/findlocale.c
@@ -79,8 +79,8 @@ valid_locale_name (const char *name)
     return 0;
   /* Directory traversal attempt.  */
   static const char slashdot[4] = {'/', '.', '.', '/'};
-  if (__glibc_unlikely (memmem (name, namelen,
-				slashdot, sizeof (slashdot)) != NULL))
+  if (__glibc_unlikely (__memmem (name, namelen,
+				  slashdot, sizeof (slashdot)) != NULL))
     return 0;
   if (namelen == 2 && __glibc_unlikely (name[0] == '.' && name [1] == '.'))
     return 0;