summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorali <ali198724@gmail.com>2019-12-20 06:13:36 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-23 17:43:13 +0100
commited0572a33a28429f1ad6e47cb5bee9ef816e4a45 (patch)
tree406b37fa4980d8f309390626508fc0988546232d /src
parentb90c50ad170a437ced84743b66de1f139dc715b8 (diff)
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
Diffstat (limited to '')
-rw-r--r--src/lib/edje/edje_entry.c14
1 files 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
799static Eina_Bool 799static Eina_Bool
800_edje_entry_style_tag_check(Edje_Real_Part *rp, const char *tag) 800_edje_entry_style_tag_check(Edje_Real_Part *rp, const char *tag)
801{ 801{
802 if (!tag) return EINA_FALSE;
802 const Evas_Textblock_Style *ts = NULL; 803 const Evas_Textblock_Style *ts = NULL;
803 804
804 ts = evas_object_textblock_style_user_peek(rp->object); 805 ts = evas_object_textblock_style_user_peek(rp->object);
806 if (!ts) ts = evas_object_textblock_style_get(rp->object);
805 if (ts) 807 if (ts)
806 { 808 {
807 if (strstr(evas_textblock_style_get(ts), tag)) return EINA_TRUE; 809 const char *style_str = evas_textblock_style_get(ts);
808 } 810 if (!style_str) return EINA_FALSE;
809 else 811 if (strstr(style_str, tag)) return EINA_TRUE;
810 {
811 ts = evas_object_textblock_style_get(rp->object);
812 if (ts)
813 {
814 if (strstr(evas_textblock_style_get(ts), tag)) return EINA_TRUE;
815 }
816 } 812 }
817 813
818 return EINA_FALSE; 814 return EINA_FALSE;