Dear all,
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 3 Dec 2012 07:54:07 +0000 (07:54 +0000)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 3 Dec 2012 07:54:07 +0000 (07:54 +0000)
 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

13 files changed:
src/bin/e_exec.c
src/bin/e_fm.c
src/bin/e_fm/e_fm_ipc.c
src/bin/e_fm/e_fm_main_udisks.c
src/bin/e_gadcon_popup.c
src/bin/e_import_config_dialog.c
src/bin/e_randr_11_serialization.c
src/bin/e_randr_12.c
src/bin/e_randr_12_serialization.c
src/bin/e_widget_fsel.c
src/modules/conf_applications/e_int_config_defapps.c
src/modules/conf_theme/e_int_config_theme.c
src/modules/gadman/e_mod_config.c

index 3b6b941..4fe2623 100644 (file)
@@ -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 = '.';
index 8b4f76a..e89318d 100644 (file)
@@ -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)
      {
index 371ca1d..1abbb53 100644 (file)
@@ -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;
 }
 
index 0a13214..7e7223b 100644 (file)
@@ -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,
index 6f4af3c..4d91bac 100644 (file)
@@ -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);
index 56b7ed7..482c92d 100644 (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_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;
index f6a9f5b..8a2a111 100644 (file)
@@ -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;
 }
index 0be647b..c731681 100644 (file)
@@ -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;
 }
index 61cb54a..8d97ae5 100644 (file)
@@ -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();
index 6ae9b8a..ad41741 100644 (file)
@@ -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);
index 3f66494..af4c114 100644 (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)
           {
-             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);
index eb91658..ae5dbb3 100644 (file)
@@ -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
index 3fba7f0..c3bdd17 100644 (file)
@@ -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;