changeset 312:e2156468f4e5

better workaround for the bug of pidgin 2.5.x that purple_markup_unescape_entity() returns wrong entity length for a string in hexadecimal numeric expression.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 08 Jul 2009 14:56:48 +0900
parents 5a22c65d019c
children 09e1995fbda1
files util.c
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/util.c	Sun Jul 05 10:40:27 2009 +0900
+++ b/util.c	Wed Jul 08 14:56:48 2009 +0900
@@ -89,19 +89,26 @@
             ent = purple_markup_unescape_entity(ptr, &entlen);
             if(ent != NULL) {
                 while(*ent) {
-                    *ptr2++ = *ent++;
+                    if(ptr2 - html < srclen)
+                        *ptr2++ = *ent++;
+                    else
+                        ent++;
                 }
                 ptr += entlen;
             }
             else {
-                *ptr2++ = *ptr++;
+                if(ptr2 - html < srclen)
+                    *ptr2++ = *ptr++;
+                else
+                    ptr++;
             }
         }
         else {
-            *ptr2++ = *ptr++;
+            if(ptr2 - html < srclen)
+                *ptr2++ = *ptr++;
+            else
+                ptr++;
         }
-        if(ptr2 - html > srclen)
-            break;
     } /* for */
 
     str = g_strdup("\0");