diff options
author | Michael Catanzaro <mcatanzaro@posteo.net> | 2019-03-07 16:30:32 +0000 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@posteo.net> | 2019-03-07 16:30:32 +0000 |
commit | 471c536bafd8e8f24de76d369bfe5b8d6c67272e (patch) | |
tree | 849ca2c3e3c395f324d9b40d01d2e52a866639a4 /lib | |
parent | 410b82acb76bbaaceeed84a5fbfa371443067165 (diff) | |
download | epiphany-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.c | 4 |
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); } |