Dear Elementary developers.

It's a bugfix patch at elm_label.
Revised some char iteration and fix potential null ptr ref in
strbuf_key_value_replace.

Thank you.

-------------------------------------------
Hyoyoung CHANG
Engineer

SAMSUNG ELECTRONICS, Co., Ltd.
E-mail: hyoyoung.ch...@samsung.com
-------------------------------------------

Attachment: elm_label.patch
Description: Binary data

Index: src/lib/elm_label.c
===================================================================
--- src/lib/elm_label.c (revision 56065)
+++ src/lib/elm_label.c (working copy)
@@ -252,27 +252,29 @@
         
         if ((starttag) && (endtag) && (tagtxtlen > key_len))
           {
+             char *eqchar = NULL;
              repbuf = eina_strbuf_new();
              diffbuf = eina_strbuf_new();
              eina_strbuf_append_n(repbuf, starttag, tagtxtlen);
              srcstring = eina_strbuf_string_get(repbuf);
              curlocater = strstr(srcstring, key);
-             if (curlocater)
+             eqchar = curlocater+key_len;
+             if (curlocater && (*eqchar == ' ' || *eqchar == '='))
                {
-                  replocater = curlocater + key_len + 1;
-                  while ((*replocater != '=') && (replocater))
-                    replocater++;
+                  eqchar = strchr(curlocater+key_len, '=');
+                  replocater = eqchar + 1;
 
-                  while ((*replocater) && 
-                         (*replocater != ' ') && 
-                         (*replocater != '>'))
-                    replocater++;
+                  if (*eqchar)
+                    {
+                       while ((*replocater) && (*replocater != ' ') && 
(*replocater != '>'))
+                         replocater++;
 
-                  if ((replocater - curlocater) > (key_len + 1))
-                    {
-                       replocater--;
-                       eina_strbuf_append_n(diffbuf, curlocater, 
-                                            replocater-curlocater);
+                       if (replocater - curlocater > key_len)
+                         eina_strbuf_append_n(diffbuf, curlocater, 
+                                              replocater-curlocater);
+                       else
+                         insertflag = 1;
+
                     }
                   else
                     insertflag = 1;
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to