[epiphany/mcatanzaro/locale-crash: 1/2] gnome-languages: fix crashes on unexpected locales



commit 0377c30821cc6f13d93bd5a270c675d3f9b00d64
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]