From ed0572a33a28429f1ad6e47cb5bee9ef816e4a45 Mon Sep 17 00:00:00 2001 From: ali Date: Fri, 20 Dec 2019 06:13:36 +0000 Subject: [PATCH] edje_entry: avoid strstr undefined behaviour strstr behaviour is undefined when passing null to it, we will check if null is passed, then skip. elm_entry had issue, where crash happened when click on link for example. elementry_test -> entry -> click on link (crash will happened) T8535 Reviewed-by: Marcel Hollerbach Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D10877 --- src/lib/edje/edje_entry.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index 92bc0df031..3d4e47207d 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -799,20 +799,16 @@ _sel_update(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entr static Eina_Bool _edje_entry_style_tag_check(Edje_Real_Part *rp, const char *tag) { + if (!tag) return EINA_FALSE; const Evas_Textblock_Style *ts = NULL; ts = evas_object_textblock_style_user_peek(rp->object); + if (!ts) ts = evas_object_textblock_style_get(rp->object); if (ts) { - if (strstr(evas_textblock_style_get(ts), tag)) return EINA_TRUE; - } - else - { - ts = evas_object_textblock_style_get(rp->object); - if (ts) - { - if (strstr(evas_textblock_style_get(ts), tag)) return EINA_TRUE; - } + const char *style_str = evas_textblock_style_get(ts); + if (!style_str) return EINA_FALSE; + if (strstr(style_str, tag)) return EINA_TRUE; } return EINA_FALSE;