From 43e9f652bf4b2195b04fc14c93db591b30a7b790 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 18 May 2015 12:11:25 -0400 Subject: fix null pointer dereference in dcngettext under specific conditions if setlocale has not been called, the current locale's messages_name may be a null pointer. the code path where it's assumed to be non-null was only reachable if bindtextdomain had already been called, which is normally not done in programs which do not call setlocale, so the omitted check went unnoticed. patch from Void Linux, with description rewritten. --- src/locale/dcngettext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locale/dcngettext.c b/src/locale/dcngettext.c index 0057cb56..30dd41d4 100644 --- a/src/locale/dcngettext.c +++ b/src/locale/dcngettext.c @@ -132,7 +132,7 @@ char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, switch (category) { case LC_MESSAGES: locname = loc->messages_name; - if (!*locname) goto notrans; + if (!locname || !*locname) goto notrans; break; case LC_TIME: case LC_MONETARY: -- cgit v1.2.1