From b03c0739db10c8b669f9fee47ec74166a06143ed Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 6 Aug 2019 17:00:38 +0100 Subject: [PATCH] wireless mod - fix out of bound type array accesses coverity pointed this out. certainly 1403948 is definitely possible if no geometry matches succeed. fix CID 1403948 fix CID 1403944 fix CID 1403928 --- src/modules/wireless/wireless.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/modules/wireless/wireless.c b/src/modules/wireless/wireless.c index 30cbf68d2..1328609fd 100644 --- a/src/modules/wireless/wireless.c +++ b/src/modules/wireless/wireless.c @@ -1005,8 +1005,10 @@ _wireless_gadget_configure_cb(Evas_Object *g) if (!menu_icon) return NULL; for (type = 0; type < WIRELESS_SERVICE_TYPE_LAST; type++) - if (inst->icon[type] == menu_icon) - break; + { + if (inst->icon[type] == menu_icon) break; + } + if (type >= WIRELESS_SERVICE_TYPE_LAST) return NULL; return _wireless_gadget_edit(type); } @@ -1024,6 +1026,7 @@ _wireless_gadget_menu_populate_cb(Evas_Object *g, E_Menu *m EINA_UNUSED) evas_object_geometry_get(inst->icon[type], &x, &y, &w, &h); if (E_INSIDE(px, py, x, y, w, h)) break; } + if (type >= WIRELESS_SERVICE_TYPE_LAST) return; menu_icon = inst->icon[type]; } @@ -1047,8 +1050,10 @@ _wireless_gadget_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, voi if (e_desklock_state_get()) return; if (auth_popup) return; for (type = 0; type < WIRELESS_SERVICE_TYPE_LAST; type++) - if (obj == inst->icon[type]) - break; + { + if (obj == inst->icon[type]) break; + } + if (type >= WIRELESS_SERVICE_TYPE_LAST) return; if (ev->button == 2) connman_technology_enabled_set(type, !wireless_type_enabled[type]); if (ev->button != 1) return; if (wireless_popup.popup)