From 503d7305dba330dc561cc8b40e8f26eff82c7462 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 5 Dec 2012 11:13:09 +0000 Subject: [PATCH] Dear all, As I've said before, I'm attached a patch for minor bugs in the e17 again. Please take a look at attached patch. 01. missing E_FREE(wev) if zone is null File: src/bin/e_actions.c: 1467 Function: ACT_FN_GO_EDGE macro function null check of zone and wev, it would be better to separate them. 02. dead code File: src/bin/e_configure.c: 338 Function: _e_configure_efreet_desktop_update 03. array buf might be overwritten by "buf[i] = '\0'" File: src/bin/e_eap_editor.c: 412 Function: _e_desktop_edit_user_local_desktop_filename_generate 04. missing null check File: src/bin/e_fm.c Function: e_fm2_icon_get: 2196 It would be better to check ic->info.file in e_fm2_icon_get before passing to _e_fm2_file_is_edje because it doesn't check null pointer. 05. array 'path' might be overwritten by "path[i + 1] = XXX" File: src/bin/e_fm.c: 4299 Function: _e_fm2_uri_parse 06. missing null check File: src/bin/e_fm_device.c: 468 Function: e_fm2_device_mount_find If the null pointer is passed to e_fm2_device_mount_find, then it attempt to compare string using strncmp without null check. e.g., e_fm2_path_set -> real_path = _e_fm2_dev_path_map: this function could return null. -> sd->realpath = real_path; -> e_fm2_device_mount_find(sd->realpath) 07. missing free(fstrip) File: src/bin/e_import_config_dialog.c: 34 Function: _import_edj_gen 08. missing _module_free(cfm) File: src/bin/e_int_config_modules.c: 530 Function: _load_modules 09. missing free(class) in for loop File: src/bin/e_int_menus.c: 1187 Function: _e_int_menus_clients_add_by_class 10. missing free(roots) File: src/bin/e_main.c: 1646 Function: _e_main_screens_init Actually only e_win_init function could return 0. But I've added free to other codes for the consistency. 11. missing null check of 'es->cfg' File: src/bin/e_shelf.c: 2583 Function: _e_shelf_bindings_add 'es->cfg' might be null. please look at e_shelf_position_calc. 12. no ect->category check before comparing string values File: src/bin/e_theme.c: 387 Function: e_theme_config_remove I'm not sure, but inner if block checks ect->category before deleting a string. 13. missing E_FREE(wcb) in while loop File: src/bin/e_widget_ilist.c: 146 Function: _queue_timer 14. dereferencing freed pointer 'entry' File: src/modules/quickaccess/e_mod_quickaccess.c: 583 Function: _e_qa_event_border_remove_cb 15. missing E_FREE(trov) File: src/modules/tiling/e_mod_tiling.c: 3106 Function: _do_transition_overlay Thanks & Regards, Gwanglim SVN revision: 80231 --- src/bin/e_actions.c | 3 ++- src/bin/e_configure.c | 2 +- src/bin/e_eap_editor.c | 2 +- src/bin/e_fm.c | 4 ++-- src/bin/e_fm_device.c | 2 ++ src/bin/e_import_config_dialog.c | 6 +++++- src/bin/e_int_config_modules.c | 1 + src/bin/e_int_menus.c | 1 + src/bin/e_main.c | 18 +++++++++++++++--- src/bin/e_shelf.c | 4 +++- src/bin/e_theme.c | 2 +- src/bin/e_widget_ilist.c | 4 ++++ src/modules/quickaccess/e_mod_quickaccess.c | 1 + src/modules/tiling/e_mod_tiling.c | 5 ++++- 14 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/bin/e_actions.c b/src/bin/e_actions.c index e4af0deaf..f623d90bf 100644 --- a/src/bin/e_actions.c +++ b/src/bin/e_actions.c @@ -1463,8 +1463,9 @@ ACT_FN_GO_EDGE(desk_flip_in_direction, ) if (!ev) return; // with flip on _e_zone_cb_edge_timer we don't have ev!!! zone = _e_actions_zone_get(obj); + if (!zone) return; wev = E_NEW(E_Event_Pointer_Warp, 1); - if ((!wev) || (!zone)) return; + if (!wev) return; ecore_x_pointer_xy_get(zone->container->win, &x, &y); wev->prev.x = x; wev->prev.y = y; diff --git a/src/bin/e_configure.c b/src/bin/e_configure.c index 00d3dd793..44072e668 100644 --- a/src/bin/e_configure.c +++ b/src/bin/e_configure.c @@ -333,7 +333,7 @@ _e_configure_efreet_desktop_update(void) /* get desktops */ settings_desktops = efreet_util_desktop_category_list("Settings"); system_desktops = efreet_util_desktop_category_list("System"); - if ((!settings_desktops) && (!system_desktops)) + if ((!settings_desktops) || (!system_desktops)) { EINA_LIST_FREE(settings_desktops, desktop) efreet_desktop_free(desktop); diff --git a/src/bin/e_eap_editor.c b/src/bin/e_eap_editor.c index 80fcc9317..5ed681116 100644 --- a/src/bin/e_eap_editor.c +++ b/src/bin/e_eap_editor.c @@ -402,7 +402,7 @@ _e_desktop_edit_user_local_desktop_filename_generate(E_Config_Dialog_Data *cfdat if (name) { const char *s = name; - for (i = 0; i < sizeof(buf) && s[i]; i++) + for (i = 0; i < sizeof(buf) - 1 && s[i]; i++) { if (isalnum(s[i])) buf[i] = s[i]; diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 4b49a9b90..e2426236e 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -2193,7 +2193,7 @@ e_fm2_icon_get(Evas *evas, E_Fm2_Icon *ic, ic->thumb_failed = EINA_TRUE; /* create thumbnails for edje files */ - if (_e_fm2_file_is_edje(ic->info.file)) + if ((ic->info.file) && (_e_fm2_file_is_edje(ic->info.file))) { o = _e_fm2_icon_thumb_edje_get (evas, ic, gen_func, data, force_gen, type_ret); @@ -4296,7 +4296,7 @@ _e_fm2_uri_parse(const char *val) hostname[i] = '\0'; /* See http://www.faqs.org/rfcs/rfc1738.html for the escaped chars */ - for (i = 0; *p != '\0' && i < PATH_MAX; i++, p++) + for (i = 0; (*p != '\0') && (i < (PATH_MAX-1)); i++, p++) { if (*p == '%') { diff --git a/src/bin/e_fm_device.c b/src/bin/e_fm_device.c index aea15d838..d388137f4 100644 --- a/src/bin/e_fm_device.c +++ b/src/bin/e_fm_device.c @@ -465,6 +465,8 @@ e_fm2_device_mount_find(const char *path) Eina_List *l; E_Volume *v; + if (!path) return NULL; + EINA_LIST_FOREACH(_e_vols, l, v) { if (v->mounted diff --git a/src/bin/e_import_config_dialog.c b/src/bin/e_import_config_dialog.c index 482c92dc5..16e6ec374 100644 --- a/src/bin/e_import_config_dialog.c +++ b/src/bin/e_import_config_dialog.c @@ -31,7 +31,11 @@ _import_edj_gen(E_Import_Config_Dialog *import) fstrip = ecore_file_strip_ext(file); if (!fstrip) return; len = e_user_dir_snprintf(buf, sizeof(buf), "backgrounds/%s.edj", fstrip); - if (len >= sizeof(buf)) return; + if (len >= sizeof(buf)) + { + free(fstrip); + return; + } off = len - (sizeof(".edj") - 1); for (num = 1; ecore_file_exists(buf) && num < 100; num++) snprintf(buf + off, sizeof(buf) - off, "-%d.edj", num); diff --git a/src/bin/e_int_config_modules.c b/src/bin/e_int_config_modules.c index 15568760d..0e9f3fd5f 100644 --- a/src/bin/e_int_config_modules.c +++ b/src/bin/e_int_config_modules.c @@ -527,6 +527,7 @@ _load_modules(const char *dir, Eina_Hash *types_hash) if (!cft->modules_hash) { if (new_type) _cftype_free(cft); + _module_free(cfm); goto end_desktop; } eina_hash_direct_add(cft->modules_hash, cfm->short_name, cfm); diff --git a/src/bin/e_int_menus.c b/src/bin/e_int_menus.c index ed488f314..45ca7b6e6 100644 --- a/src/bin/e_int_menus.c +++ b/src/bin/e_int_menus.c @@ -1184,6 +1184,7 @@ _e_int_menus_clients_add_by_class(Eina_List *borders, E_Menu *m) mi = e_menu_item_new(m); e_menu_item_separator_set(mi, 1); } + free(class); class = strdup(bd->client.icccm.class); } if (e_config->clientlist_separate_with == E_CLIENTLIST_GROUP_SEP_MENU) diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 9b9d484a6..b5b30f07e 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -1643,11 +1643,23 @@ _e_main_screens_init(void) return 0; } TS("\tscreens: focus"); - if (!e_focus_init()) return 0; + if (!e_focus_init()) + { + free(roots); + return 0; + } TS("\tscreens: border"); - if (!e_border_init()) return 0; + if (!e_border_init()) + { + free(roots); + return 0; + } TS("\tscreens: win"); - if (!e_win_init()) return 0; + if (!e_win_init()) + { + free(roots); + return 0; + } TS("\tscreens: manage roots"); for (i = 0; i < num; i++) { diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index da995542a..a74f9d0f5 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -2580,7 +2580,9 @@ _e_shelf_bindings_add(E_Shelf *es) _e_shelf_bindings_del(es); /* Don't need edge binding if we don't hide shelf */ - if ((!es->cfg->autohide) && (!es->cfg->autohide_show_action)) return; + if ((es->cfg) && (!es->cfg->autohide) && + (!es->cfg->autohide_show_action)) + return; snprintf(buf, sizeof(buf), "shelf.%d", es->id); switch (es->gadcon->orient) diff --git a/src/bin/e_theme.c b/src/bin/e_theme.c index a668ed9ae..933ab4596 100644 --- a/src/bin/e_theme.c +++ b/src/bin/e_theme.c @@ -384,7 +384,7 @@ e_theme_config_remove(const char *category) /* search for the category */ EINA_LIST_FOREACH(e_config->themes, next, ect) { - if (!strcmp(ect->category, category)) + if (!e_util_strcmp(ect->category, category)) { e_config->themes = eina_list_remove_list(e_config->themes, next); if (ect->category) eina_stringshare_del(ect->category); diff --git a/src/bin/e_widget_ilist.c b/src/bin/e_widget_ilist.c index 1db3e500a..a4e338491 100644 --- a/src/bin/e_widget_ilist.c +++ b/src/bin/e_widget_ilist.c @@ -143,6 +143,10 @@ _queue_timer(void *data) _e_wid_cb_item_sel, _e_wid_cb_item_hilight, wd, wcb); } } + else + { + E_FREE(wcb); + } if (qi->icon) evas_object_show(qi->icon); if (qi->end) evas_object_show(qi->end); } diff --git a/src/modules/quickaccess/e_mod_quickaccess.c b/src/modules/quickaccess/e_mod_quickaccess.c index 87f299358..c2ca9a517 100644 --- a/src/modules/quickaccess/e_mod_quickaccess.c +++ b/src/modules/quickaccess/e_mod_quickaccess.c @@ -578,6 +578,7 @@ _e_qa_event_border_remove_cb(void *data __UNUSED__, int type __UNUSED__, E_Event { DBG("closed transient qa border: deleting keybind and entry"); e_qa_entry_free(entry); + return ECORE_CALLBACK_RENEW; } else if (entry->config.relaunch) _e_qa_border_new(entry); entry->border = NULL; diff --git a/src/modules/tiling/e_mod_tiling.c b/src/modules/tiling/e_mod_tiling.c index b8e661f17..f0a6c339f 100644 --- a/src/modules/tiling/e_mod_tiling.c +++ b/src/modules/tiling/e_mod_tiling.c @@ -3103,7 +3103,10 @@ _do_transition_overlay(void) trov->overlay.popup = e_popup_new(bd->zone, 0, 0, 1, 1); if (!trov->overlay.popup) - continue; + { + E_FREE(trov); + continue; + } e_popup_layer_set(trov->overlay.popup, E_LAYER_NORMAL); trov->overlay.obj = edje_object_add(trov->overlay.popup->evas);