summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@posteo.net>2019-03-07 16:30:32 +0000
committerMichael Catanzaro <mcatanzaro@posteo.net>2019-03-07 16:30:32 +0000
commit471c536bafd8e8f24de76d369bfe5b8d6c67272e (patch)
tree849ca2c3e3c395f324d9b40d01d2e52a866639a4 /lib
parent410b82acb76bbaaceeed84a5fbfa371443067165 (diff)
downloadepiphany-471c536bafd8e8f24de76d369bfe5b8d6c67272e.tar.gz
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/contrib/gnome-languages.c4
1 files changed, 4 insertions, 0 deletions
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);
}