[epiphany/mcatanzaro/locale-crash: 2/3] gnome-languages: fix crashes on unexpected locales
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/locale-crash: 2/3] gnome-languages: fix crashes on unexpected locales
- Date: Thu, 7 Mar 2019 03:46:53 +0000 (UTC)
commit 37f9ca74b732697341090aef8dc8b50164e92c7f
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Wed Mar 6 21:15:57 2019 -0600
gnome-languages: fix crashes on unexpected locales
I forgot to error-check the result of newlocale to make sure it's really
a valid locale.
lib/contrib/gnome-languages.c | 4 ++++
1 file changed, 4 insertions(+)
---
diff --git a/lib/contrib/gnome-languages.c b/lib/contrib/gnome-languages.c
index b754229e6..d663c1507 100644
--- a/lib/contrib/gnome-languages.c
+++ b/lib/contrib/gnome-languages.c
@@ -710,6 +710,8 @@ get_translated_language (const char *code,
if (locale != NULL) {
loc = newlocale (LC_MESSAGES_MASK, locale, (locale_t) 0);
+ if (loc == (locale_t) 0)
+ return NULL;
old_locale = uselocale (loc);
}
@@ -767,6 +769,8 @@ get_translated_territory (const char *code,
if (locale != NULL) {
loc = newlocale (LC_MESSAGES_MASK, locale, (locale_t) 0);
+ if (loc == (locale_t) 0)
+ return NULL;
old_locale = uselocale (loc);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]