From 362531b0829363d19d0ccf0857793e40999b5957 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 3 Dec 2012 07:54:07 +0000 Subject: [PATCH] Dear all, I'm attaching a patch for some minor bugs in the e17. Please take a look at attached patch. 01. missing E_FREE(inst) File: src/bin/e_exec.c: 347 Function: _e_exec_cb_exec 02. missing null check File: src/bin/e_fm.c: 10173 Function: _e_fm_error_dialog I'm not sure, but all other codes always check the return value of e_fm2_op_registry_entry_get except here. 03. missing free(slave) File: src/bin/e_fm_ipc.c: 804 Function: _e_fm_ipc_slave_run 04. eina_list_remove after free File: src/bin/e_fm/e_fm_ipc.c :1325 Function: _e_fm_ipc_cb_fop_trash_idler 05. invalid check for _udisks_del, it might be _udisks_chg. File: src/bin/e_fm/e_fm_main_udisks.c : 162 Function: _e_fm_main_udisks_test 06. uninitialized gx and gy values File: src/bin/e_gadcon_popup.c: 172 Function: _e_gadcon_popup_position These could be changed in e_gadcon_client_geometry_get if gcc->o_base is null. 07. unnecessary code 'evas = e_win_evas_get(dia->win)' File: src/bin/e_import_config_dialog.c: 456 Function: e_import_config_dialog_show 08. missing free(sizes) src/bin/e_randr_11_serialization.c: 136 Function: _11_try_restore_configuration() 09. unnecessary variable output_info File: src/bin/e_randr_12.c: 560 Function: _output_property_change_event_cb 10. eina_list_remove after free File: src/bin/e_randr_12_serialization.c : 357 Function: _12_serialized_setup_update 11. no check of the return value of symlink. File: src/bin/e_widget_fsel.c: 84 Function: _e_wid_fsel_favorites_add 12. no evr->var check before comparing string values File: src/modules/conf_applications/e_int_config_defapps.c: 432 Function: _basic_apply 13. missing error message or check return value of edje_file_group_exists File: src/modules/conf_theme/e_int_config_theme.c: 333 Function: _open_test_cb Anyway, I've added e_util_dialog_show if failed. Is it okay? 14. missing index range check File: src/modules/gadman/e_mod_config.c: 153 Function: _cb_config It could read negative array index, because return value of e_widget_ilist_selected_get might be negative. BR, Gwanglim SVN revision: 80020 --- src/bin/e_exec.c | 6 +++++- src/bin/e_fm.c | 1 + src/bin/e_fm/e_fm_ipc.c | 8 ++++++-- src/bin/e_fm/e_fm_main_udisks.c | 2 +- src/bin/e_gadcon_popup.c | 2 +- src/bin/e_import_config_dialog.c | 2 -- src/bin/e_randr_11_serialization.c | 4 +++- src/bin/e_randr_12.c | 3 +-- src/bin/e_randr_12_serialization.c | 2 +- src/bin/e_widget_fsel.c | 6 ++++-- src/modules/conf_applications/e_int_config_defapps.c | 2 +- src/modules/conf_theme/e_int_config_theme.c | 5 ++++- src/modules/gadman/e_mod_config.c | 2 ++ 13 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/bin/e_exec.c b/src/bin/e_exec.c index 3b6b941cd..4fe262312 100644 --- a/src/bin/e_exec.c +++ b/src/bin/e_exec.c @@ -344,7 +344,11 @@ _e_exec_cb_exec(void *data, Efreet_Desktop *desktop, char *exec, int remaining) penv_display_length = strlen(penv_display); /* Check for insane length for DISPLAY env */ - if (penv_display_length + 32 > 4096) return NULL; + if (penv_display_length + 32 > 4096) + { + E_FREE(inst); + return NULL; + } /* buf2 = '.%i' */ *buf2 = '.'; diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 8b4f76ab1..e89318d54 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -10171,6 +10171,7 @@ _e_fm_error_dialog(int pid, const char *str) id = (intptr_t*)(long)pid; ere = e_fm2_op_registry_entry_get(pid); + if (!ere) return NULL; sd = evas_object_smart_data_get(ere->e_fm); while (sd->realpath) { diff --git a/src/bin/e_fm/e_fm_ipc.c b/src/bin/e_fm/e_fm_ipc.c index 371ca1d52..1abbb53a9 100644 --- a/src/bin/e_fm/e_fm_ipc.c +++ b/src/bin/e_fm/e_fm_ipc.c @@ -801,7 +801,11 @@ _e_fm_ipc_slave_run(E_Fm_Op_Type type, const char *args, int id) if (!slave) return 0; command = eina_stringshare_add(_e_fm_ipc_prepare_command(type, args)); - if (!command) return 0; + if (!command) + { + free(slave); + return 0; + } slave->id = id; slave->exe = ecore_exe_pipe_run(command, ECORE_EXE_PIPE_WRITE | ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR, slave); @@ -1318,8 +1322,8 @@ _e_fm_ipc_cb_fop_trash_idler(void *data) if (trash_dir) eina_stringshare_del(trash_dir); eina_stringshare_del(fop->src); eina_stringshare_del(fop->dst); - free(fop); _e_fops = eina_list_remove(_e_fops, fop); + free(fop); return ECORE_CALLBACK_CANCEL; } diff --git a/src/bin/e_fm/e_fm_main_udisks.c b/src/bin/e_fm/e_fm_main_udisks.c index 0a1321495..7e7223bbe 100644 --- a/src/bin/e_fm/e_fm_main_udisks.c +++ b/src/bin/e_fm/e_fm_main_udisks.c @@ -158,7 +158,7 @@ _e_fm_main_udisks_test(void *data __UNUSED__, E_UDISKS_PATH, E_UDISKS_BUS, "DeviceRemoved", (E_DBus_Signal_Cb)_e_fm_main_udisks_cb_dev_del, NULL); - if (!_udisks_del) + if (!_udisks_chg) _udisks_chg = e_dbus_signal_handler_add(_e_fm_main_udisks_conn, E_UDISKS_BUS, E_UDISKS_PATH, E_UDISKS_BUS, diff --git a/src/bin/e_gadcon_popup.c b/src/bin/e_gadcon_popup.c index 6f4af3c7d..4d91bacc7 100644 --- a/src/bin/e_gadcon_popup.c +++ b/src/bin/e_gadcon_popup.c @@ -166,7 +166,7 @@ _e_gadcon_popup_size_recalc(E_Gadcon_Popup *pop, Evas_Object *obj) static void _e_gadcon_popup_position(E_Gadcon_Popup *pop) { - Evas_Coord gx, gy, gw, gh, zw, zh, zx, zy, px, py; + Evas_Coord gx = 0, gy = 0, gw, gh, zw, zh, zx, zy, px, py; /* Popup positioning */ e_gadcon_client_geometry_get(pop->gcc, &gx, &gy, &gw, &gh); diff --git a/src/bin/e_import_config_dialog.c b/src/bin/e_import_config_dialog.c index 56b7ed755..482c92dc5 100644 --- a/src/bin/e_import_config_dialog.c +++ b/src/bin/e_import_config_dialog.c @@ -453,8 +453,6 @@ e_import_config_dialog_show(E_Container *con, const char *path, Ecore_End_Cb ok, e_object_del_attach_func_set(E_OBJECT(dia), _e_import_config_dia_del); e_win_delete_callback_set(dia->win, _e_import_config_dialog_win_del); - evas = e_win_evas_get(dia->win); - import->method = IMPORT_SCALE_ASPECT_OUT; import->external = 0; import->quality = 90; diff --git a/src/bin/e_randr_11_serialization.c b/src/bin/e_randr_11_serialization.c index f6a9f5bff..8a2a11195 100644 --- a/src/bin/e_randr_11_serialization.c +++ b/src/bin/e_randr_11_serialization.c @@ -96,7 +96,7 @@ e_randr_11_serialized_setup_free(E_Randr_Serialized_Setup_11 *ss_11) Eina_Bool _11_try_restore_configuration(void) { - Ecore_X_Randr_Screen_Size_MM *stored_size, *sizes; + Ecore_X_Randr_Screen_Size_MM *stored_size, *sizes = NULL; int i = 0, nsizes; #define SIZE_EQUAL(size) \ @@ -133,5 +133,7 @@ _11_try_restore_configuration(void) } #undef SIZE_EQUAL + free(sizes); + return EINA_FALSE; } diff --git a/src/bin/e_randr_12.c b/src/bin/e_randr_12.c index 0be647b65..c73168121 100644 --- a/src/bin/e_randr_12.c +++ b/src/bin/e_randr_12.c @@ -545,7 +545,6 @@ static Eina_Bool _output_property_change_event_cb(void *data __UNUSED__, int type, void *ev) { Ecore_X_Event_Randr_Output_Property_Notify *opce = (Ecore_X_Event_Randr_Output_Property_Notify *)ev; - E_Randr_Output_Info *output_info; EINA_SAFETY_ON_TRUE_RETURN_VAL(E_RANDR_12_NO, ECORE_CALLBACK_RENEW); EINA_SAFETY_ON_TRUE_RETURN_VAL((type != ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY), ECORE_CALLBACK_RENEW); @@ -557,7 +556,7 @@ _output_property_change_event_cb(void *data __UNUSED__, int type, void *ev) Ecore_X_Time time; Ecore_X_Randr_Property_Change state; */ - EINA_SAFETY_ON_FALSE_RETURN_VAL((output_info = _12_screen_info_output_info_get(opce->output)), ECORE_CALLBACK_RENEW); + EINA_SAFETY_ON_FALSE_RETURN_VAL((_12_screen_info_output_info_get(opce->output)), ECORE_CALLBACK_RENEW); return ECORE_CALLBACK_RENEW; } diff --git a/src/bin/e_randr_12_serialization.c b/src/bin/e_randr_12_serialization.c index 61cb54ac2..8d97ae5ae 100644 --- a/src/bin/e_randr_12_serialization.c +++ b/src/bin/e_randr_12_serialization.c @@ -353,8 +353,8 @@ _12_serialized_setup_update(Eina_List *setups_12) if ((ss_12 = _matching_serialized_setup_get(setups_12))) { INF("E_RANDR: Found stored configuration that matches current setup. It was created at %f. Freeing it...", ss_12->timestamp); - _12_serialized_setup_free(ss_12); setups_12 = eina_list_remove(setups_12, ss_12); + _12_serialized_setup_free(ss_12); } } ss_12 = _12_serialized_setup_new(); diff --git a/src/bin/e_widget_fsel.c b/src/bin/e_widget_fsel.c index 6ae9b8a8b..ad41741ac 100644 --- a/src/bin/e_widget_fsel.c +++ b/src/bin/e_widget_fsel.c @@ -53,6 +53,7 @@ _e_wid_fsel_favorites_add(void *data1, void *data2 __UNUSED__) struct stat st; FILE *f; size_t len; + int ret; wd = data1; current_path = e_fm2_real_path_get(wd->o_files_fm); @@ -62,7 +63,7 @@ _e_wid_fsel_favorites_add(void *data1, void *data2 __UNUSED__) ecore_file_file_get(current_path)); if (len >= sizeof(buf)) return; if (stat(buf, &st) < 0) - symlink(current_path, buf); + ret = symlink(current_path, buf); else { int i = 1, maxlen; @@ -78,8 +79,9 @@ _e_wid_fsel_favorites_add(void *data1, void *data2 __UNUSED__) i++; } while (stat(buf, &st) == 0); - symlink(current_path, buf); + ret = symlink(current_path, buf); } + if (ret != 0) return; fn = ecore_file_file_get(buf); len = strlen(fn) + 1; fname = alloca(len); diff --git a/src/modules/conf_applications/e_int_config_defapps.c b/src/modules/conf_applications/e_int_config_defapps.c index 3f664942f..af4c114fc 100644 --- a/src/modules/conf_applications/e_int_config_defapps.c +++ b/src/modules/conf_applications/e_int_config_defapps.c @@ -429,7 +429,7 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { EINA_LIST_FOREACH(e_config->env_vars, l, evr) { - if (!strcmp(evr->var, "BROWSER")) + if (!e_util_strcmp(evr->var, "BROWSER")) { e_config->env_vars = eina_list_remove_list(e_config->env_vars, l); if (evr->val) eina_stringshare_del(evr->val); diff --git a/src/modules/conf_theme/e_int_config_theme.c b/src/modules/conf_theme/e_int_config_theme.c index eb91658c3..ae5dbb3ef 100644 --- a/src/modules/conf_theme/e_int_config_theme.c +++ b/src/modules/conf_theme/e_int_config_theme.c @@ -330,7 +330,10 @@ _fill_data(E_Config_Dialog_Data *cfdata) static void _open_test_cb(void *file) { - edje_file_group_exists(eet_file_get(file), "e/desktop/background"); + if (!edje_file_group_exists(eet_file_get(file), "e/desktop/background")) + e_util_dialog_show(_("Theme File Error"), + _("%s file does not contain e/desktop/background group!"), + (char*)file); } static void diff --git a/src/modules/gadman/e_mod_config.c b/src/modules/gadman/e_mod_config.c index 3fba7f0f6..c3bdd17be 100644 --- a/src/modules/gadman/e_mod_config.c +++ b/src/modules/gadman/e_mod_config.c @@ -147,6 +147,8 @@ _cb_config(void *data, void *data2 __UNUSED__) E_Gadcon *gc; x = e_widget_ilist_selected_get(cfdata->o_avail); + if (x < 0) return; + EINA_LIST_FOREACH(Man->gadcons[x], l, gc) { if (gc->zone != cfdata->cfd->dia->win->border->zone) continue;