Fix dereference of NULL issue 46/75846/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 22 Jun 2016 00:49:37 +0000 (09:49 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 22 Jun 2016 00:49:37 +0000 (09:49 +0900)
Return value of a function 'vconf_get_str' is dereferenced at e_mod_main.c:157 without checking, but it is usually checked for this function.

Change-Id: Iaf5ac8527bbf8d399c37597f10674cfceeb6e031

src/e_mod_main.c

index cf71967..b4d0289 100644 (file)
@@ -152,11 +152,14 @@ _display_language_changed_cb(keynode_t *key, void* data)
 
    /* Just in case we did not find any matching language string */
    g_keymap_index = 0;
-   for (loop = 0; loop < sizeof(g_keymap_info) / sizeof(struct _E_Input_Method_Keymap_Info); loop++)
+   if (language)
      {
-        if (strncmp(language, g_keymap_info[loop].language, strlen(g_keymap_info[loop].language)) == 0)
+        for (loop = 0; loop < sizeof(g_keymap_info) / sizeof(struct _E_Input_Method_Keymap_Info); loop++)
           {
-             g_keymap_index = loop;
+             if (strncmp(language, g_keymap_info[loop].language, strlen(g_keymap_info[loop].language)) == 0)
+               {
+                  g_keymap_index = loop;
+               }
           }
      }
    /* We do not want to change the current keymap related behavior in TV profile for now */