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
This commit is contained in:
Mike Blumenkrantz 2012-12-03 07:54:07 +00:00
parent 17e0f6d24a
commit 362531b082
13 changed files with 30 additions and 15 deletions

View File

@ -344,7 +344,11 @@ _e_exec_cb_exec(void *data, Efreet_Desktop *desktop, char *exec, int remaining)
penv_display_length = strlen(penv_display); penv_display_length = strlen(penv_display);
/* Check for insane length for DISPLAY env */ /* 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 = '.%i' */
*buf2 = '.'; *buf2 = '.';

View File

@ -10171,6 +10171,7 @@ _e_fm_error_dialog(int pid, const char *str)
id = (intptr_t*)(long)pid; id = (intptr_t*)(long)pid;
ere = e_fm2_op_registry_entry_get(pid); ere = e_fm2_op_registry_entry_get(pid);
if (!ere) return NULL;
sd = evas_object_smart_data_get(ere->e_fm); sd = evas_object_smart_data_get(ere->e_fm);
while (sd->realpath) while (sd->realpath)
{ {

View File

@ -801,7 +801,11 @@ _e_fm_ipc_slave_run(E_Fm_Op_Type type, const char *args, int id)
if (!slave) return 0; if (!slave) return 0;
command = eina_stringshare_add(_e_fm_ipc_prepare_command(type, args)); 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->id = id;
slave->exe = ecore_exe_pipe_run(command, ECORE_EXE_PIPE_WRITE | ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR, slave); 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); if (trash_dir) eina_stringshare_del(trash_dir);
eina_stringshare_del(fop->src); eina_stringshare_del(fop->src);
eina_stringshare_del(fop->dst); eina_stringshare_del(fop->dst);
free(fop);
_e_fops = eina_list_remove(_e_fops, fop); _e_fops = eina_list_remove(_e_fops, fop);
free(fop);
return ECORE_CALLBACK_CANCEL; return ECORE_CALLBACK_CANCEL;
} }

View File

@ -158,7 +158,7 @@ _e_fm_main_udisks_test(void *data __UNUSED__,
E_UDISKS_PATH, E_UDISKS_PATH,
E_UDISKS_BUS, E_UDISKS_BUS,
"DeviceRemoved", (E_DBus_Signal_Cb)_e_fm_main_udisks_cb_dev_del, NULL); "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, _udisks_chg = e_dbus_signal_handler_add(_e_fm_main_udisks_conn, E_UDISKS_BUS,
E_UDISKS_PATH, E_UDISKS_PATH,
E_UDISKS_BUS, E_UDISKS_BUS,

View File

@ -166,7 +166,7 @@ _e_gadcon_popup_size_recalc(E_Gadcon_Popup *pop, Evas_Object *obj)
static void static void
_e_gadcon_popup_position(E_Gadcon_Popup *pop) _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 */ /* Popup positioning */
e_gadcon_client_geometry_get(pop->gcc, &gx, &gy, &gw, &gh); e_gadcon_client_geometry_get(pop->gcc, &gx, &gy, &gw, &gh);

View File

@ -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_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); 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->method = IMPORT_SCALE_ASPECT_OUT;
import->external = 0; import->external = 0;
import->quality = 90; import->quality = 90;

View File

@ -96,7 +96,7 @@ e_randr_11_serialized_setup_free(E_Randr_Serialized_Setup_11 *ss_11)
Eina_Bool Eina_Bool
_11_try_restore_configuration(void) _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; int i = 0, nsizes;
#define SIZE_EQUAL(size) \ #define SIZE_EQUAL(size) \
@ -133,5 +133,7 @@ _11_try_restore_configuration(void)
} }
#undef SIZE_EQUAL #undef SIZE_EQUAL
free(sizes);
return EINA_FALSE; return EINA_FALSE;
} }

View File

@ -545,7 +545,6 @@ static Eina_Bool
_output_property_change_event_cb(void *data __UNUSED__, int type, void *ev) _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; 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(E_RANDR_12_NO, ECORE_CALLBACK_RENEW);
EINA_SAFETY_ON_TRUE_RETURN_VAL((type != ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY), 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_Time time;
Ecore_X_Randr_Property_Change state; 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; return ECORE_CALLBACK_RENEW;
} }

View File

@ -353,8 +353,8 @@ _12_serialized_setup_update(Eina_List *setups_12)
if ((ss_12 = _matching_serialized_setup_get(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); 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); setups_12 = eina_list_remove(setups_12, ss_12);
_12_serialized_setup_free(ss_12);
} }
} }
ss_12 = _12_serialized_setup_new(); ss_12 = _12_serialized_setup_new();

View File

@ -53,6 +53,7 @@ _e_wid_fsel_favorites_add(void *data1, void *data2 __UNUSED__)
struct stat st; struct stat st;
FILE *f; FILE *f;
size_t len; size_t len;
int ret;
wd = data1; wd = data1;
current_path = e_fm2_real_path_get(wd->o_files_fm); 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)); ecore_file_file_get(current_path));
if (len >= sizeof(buf)) return; if (len >= sizeof(buf)) return;
if (stat(buf, &st) < 0) if (stat(buf, &st) < 0)
symlink(current_path, buf); ret = symlink(current_path, buf);
else else
{ {
int i = 1, maxlen; int i = 1, maxlen;
@ -78,8 +79,9 @@ _e_wid_fsel_favorites_add(void *data1, void *data2 __UNUSED__)
i++; i++;
} }
while (stat(buf, &st) == 0); while (stat(buf, &st) == 0);
symlink(current_path, buf); ret = symlink(current_path, buf);
} }
if (ret != 0) return;
fn = ecore_file_file_get(buf); fn = ecore_file_file_get(buf);
len = strlen(fn) + 1; len = strlen(fn) + 1;
fname = alloca(len); fname = alloca(len);

View File

@ -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) 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); e_config->env_vars = eina_list_remove_list(e_config->env_vars, l);
if (evr->val) eina_stringshare_del(evr->val); if (evr->val) eina_stringshare_del(evr->val);

View File

@ -330,7 +330,10 @@ _fill_data(E_Config_Dialog_Data *cfdata)
static void static void
_open_test_cb(void *file) _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 static void

View File

@ -147,6 +147,8 @@ _cb_config(void *data, void *data2 __UNUSED__)
E_Gadcon *gc; E_Gadcon *gc;
x = e_widget_ilist_selected_get(cfdata->o_avail); x = e_widget_ilist_selected_get(cfdata->o_avail);
if (x < 0) return;
EINA_LIST_FOREACH(Man->gadcons[x], l, gc) EINA_LIST_FOREACH(Man->gadcons[x], l, gc)
{ {
if (gc->zone != cfdata->cfd->dia->win->border->zone) continue; if (gc->zone != cfdata->cfd->dia->win->border->zone) continue;