[gnome-desktop/wip/locale-info: 6/11] gnome-languages: Fix a potential crash



commit d4269d481e27b908a782aeebc30a0abade539ac9
Author: Rui Matos <tiagomatos gmail com>
Date:   Thu Jan 31 14:16:19 2013 +0100

    gnome-languages: Fix a potential crash
    
    We can't continue if we aren't able to parse the string because the
    return arguments will be undefined.

 libgnome-desktop/gnome-languages.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/libgnome-desktop/gnome-languages.c b/libgnome-desktop/gnome-languages.c
index d774263..6731405 100644
--- a/libgnome-desktop/gnome-languages.c
+++ b/libgnome-desktop/gnome-languages.c
@@ -253,15 +253,18 @@ gnome_normalize_language_name (const char *name)
         char *territory_code;
         char *codeset;
         char *modifier;
+        gboolean valid;
 
         if (name[0] == '\0') {
                 return NULL;
         }
 
-        gnome_parse_language_name (name,
-                                   &language_code,
-                                   &territory_code,
-                                   &codeset, &modifier);
+        valid = gnome_parse_language_name (name,
+                                           &language_code,
+                                           &territory_code,
+                                           &codeset, &modifier);
+        if (!valid)
+                return NULL;
 
         normalized_name = construct_language_name (language_code,
                                                    territory_code,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]