From 22d8702876a29b59c0ecce3fc86f70bc537d0ea0 Mon Sep 17 00:00:00 2001 From: Wonki Kim Date: Wed, 13 Feb 2019 13:39:26 +0900 Subject: [PATCH] ecore_evas: Fix a potenional null dereferencing problem there is a potentional problem while comparing strings. this patch fixes it. Change-Id: I47683300cc8e49d8450cb20590749d98c4257ba2 Signed-off-by: Wonki Kim --- src/lib/ecore_evas/ecore_evas.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index a7be3fc..5517fad 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -5454,17 +5454,24 @@ _ecore_evas_event_evas_device_get(Evas *evas, Ecore_Device *ecore_dev) { Efl_Input_Device *dev = NULL; Eina_List *list, *l; + char *rname, *lname; if (efl_class_get(ecore_dev) != EFL_INPUT_DEVICE_CLASS) return NULL; list = (Eina_List *)evas_device_list(evas, NULL); EINA_LIST_FOREACH(list, l, dev) { - if ((evas_device_class_get(dev) == (Evas_Device_Class)ecore_device_class_get(ecore_dev)) && - !strncmp(efl_name_get(dev), efl_name_get(ecore_dev), strlen(efl_name_get(dev))) && - !strncmp(efl_comment_get(dev), efl_comment_get(ecore_dev), strlen(efl_comment_get(dev)))) + if (evas_device_class_get(dev) == (Evas_Device_Class)ecore_device_class_get(ecore_dev)) { - return dev; + lname = efl_name_get(dev); + rname = efl_name_get(ecore_dev); + if (lname && rname && !strncmp(lname, rname, strlen(lname))) + { + lname = efl_comment_get(dev); + rname = efl_comment_get(ecore_dev); + if (lname && rname && !strncmp(lname, rname, strlen(lname))) + return dev; + } } } -- 2.7.4