[glib] Protect against strcmp() on NULL strings
- From: Sebastian DrÃge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Protect against strcmp() on NULL strings
- Date: Wed, 28 Nov 2012 15:27:14 +0000 (UTC)
commit 058fa6393e368a2134f18df3296c09eb33d8e951
Author: Sebastian DrÃge <sebastian droege collabora co uk>
Date: Wed Nov 28 16:25:43 2012 +0100
Protect against strcmp() on NULL strings
glib/ggettext.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/glib/ggettext.c b/glib/ggettext.c
index ed7137e..79abf0c 100644
--- a/glib/ggettext.c
+++ b/glib/ggettext.c
@@ -335,10 +335,11 @@ _g_dgettext_should_translate (void)
* - If locale is "C", maybe user calls setlocale(LC_ALL,"") later.
* Continue with old behavior of translating.
*/
- if (0 != strcmp (default_domain, "messages") &&
+ if (!default_domain || !translator_comment || !translate_locale ||
+ (0 != strcmp (default_domain, "messages") &&
'\0' == *translator_comment &&
0 != strncmp (translate_locale, "en_", 3) &&
- 0 != strcmp (translate_locale, "C"))
+ 0 != strcmp (translate_locale, "C")))
should_translate = FALSE;
g_once_init_leave (&translate,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]