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 <mail@marcel-hollerbach.de>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D10877
This commit is contained in:
Ali Alzyod 2019-12-20 06:13:36 +00:00 committed by Marcel Hollerbach
parent b90c50ad17
commit ed0572a33a
1 changed files with 5 additions and 9 deletions

View File

@ -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;