From 200ad8ab50d4a0563fe0b63dd0176954004466df Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 19 Dec 2016 19:24:45 +0100 Subject: [PATCH] efl_ui_focus_manager: be more secure --- src/lib/elementary/efl_ui_focus_manager.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lib/elementary/efl_ui_focus_manager.c b/src/lib/elementary/efl_ui_focus_manager.c index cdf58bc..82a301c 100644 --- a/src/lib/elementary/efl_ui_focus_manager.c +++ b/src/lib/elementary/efl_ui_focus_manager.c @@ -516,6 +516,11 @@ _efl_ui_focus_manager_register_logical(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, E EINA_SAFETY_ON_NULL_RETURN_VAL(child, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(parent, EINA_FALSE); + if (redirect) + EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(redirect, MY_CLASS), EINA_FALSE); + + F_DBG("Manager: %p register %p %p %p", obj, child, parent, redirect); + pnode = node_get(obj, pd, parent); if (!pnode) return EINA_FALSE; @@ -538,6 +543,11 @@ _efl_ui_focus_manager_register(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Efl_Ui_Fo EINA_SAFETY_ON_NULL_RETURN_VAL(child, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(parent, EINA_FALSE); + if (redirect) + EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(redirect, MY_CLASS), EINA_FALSE); + + F_DBG("Manager: %p register %p %p %p", obj, child, parent, redirect); + pnode = node_get(obj, pd, parent); if (!pnode) return EINA_FALSE; @@ -562,6 +572,9 @@ _efl_ui_focus_manager_update_redirect(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Ef Node *node = node_get(obj, pd, child); if (!node) return EINA_FALSE; + if (redirect) + EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(redirect, MY_CLASS), EINA_FALSE); + node->redirect_manager = redirect; return EINA_TRUE; @@ -647,6 +660,9 @@ _efl_ui_focus_manager_unregister(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Data if (!node) return; + F_DBG("Manager: %p unregister %p", obj, child); + + //remove the object from the stack if it hasnt dont that until now //after this its not at the top anymore //elm_widget_focus_set(node->focusable, EINA_FALSE); -- 2.7.4