mailing list of musl libc
 help / color / mirror / code / Atom feed
From: psykose <alice@ayaya.dev>
To: musl@lists.openwall.com
Cc: psykose <alice@ayaya.dev>, Ariadne Conill <ariadne@dereferenced.org>
Subject: [musl] [PATCH] abort transaction lookup if NULL is passed as msgid1
Date: Wed,  2 Mar 2022 21:16:54 +0100	[thread overview]
Message-ID: <20220302201654.98472-1-alice@ayaya.dev> (raw)

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@dereferenced.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


             reply	other threads:[~2022-03-02 20:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 20:16 psykose [this message]
2022-03-02 20:20 ` Ariadne Conill
2022-03-02 22:07   ` Quentin Rameau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220302201654.98472-1-alice@ayaya.dev \
    --to=alice@ayaya.dev \
    --cc=ariadne@dereferenced.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).