Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed,  2 Mar 2022 21:16:54 +0100
From: psykose <alice@...ya.dev>
To: musl@...ts.openwall.com
Cc: psykose <alice@...ya.dev>,
	Ariadne Conill <ariadne@...eferenced.org>
Subject: [PATCH] abort transaction lookup if NULL is passed as msgid1

When investigating a crash in Transmission running under musl's gettext
implementation, we observed that GNU libintl returns NULL when NULL is
passed as the msgid1.  Accordingly, make the musl gettext behavior match
GNU libintl.

Reviewed-by: Ariadne Conill <ariadne@...eferenced.org>
---
 src/locale/dcngettext.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/locale/dcngettext.c b/src/locale/dcngettext.c
index d1e6c6d1..0b53286d 100644
--- a/src/locale/dcngettext.c
+++ b/src/locale/dcngettext.c
@@ -132,6 +132,9 @@ char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2,
 	struct binding *q;
 	int old_errno = errno;
 
+	/* match gnu gettext behaviour */
+	if (!msgid1) goto notrans;
+
 	if ((unsigned)category >= LC_ALL) goto notrans;
 
 	if (!domainname) domainname = __gettextdomain();
-- 
2.35.1

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.