2007-12-10 [colin] 3.1.0cvs71
authorColin Leroy <colin@colino.net>
Mon, 10 Dec 2007 18:20:11 +0000 (18:20 +0000)
committerColin Leroy <colin@colino.net>
Mon, 10 Dec 2007 18:20:11 +0000 (18:20 +0000)
* src/common/utils.c
Fix potential buffer overrun (thanks to
Hiroyuki)

ChangeLog
PATCHSETS
configure.ac
src/common/utils.c

index eda07df7b2227f14350ca7df6db5fad2c726c699..afecbdaf768a5de97e5556cf0d22cf845944e19f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-12-10 [colin]     3.1.0cvs71
+
+       * src/common/utils.c
+               Fix potential buffer overrun (thanks to
+               Hiroyuki)
+
 2007-12-08 [paul]      3.1.0cvs70
 
        * src/prefs_receive.c
index 0f81d6ed720e97d786875ddb6cc2aa92b13eadc6..13a537ab1bab6ea793b7524ccb102615ef51036f 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.274.2.224 -r 1.274.2.225 src/mainwindow.c;  cvs diff -u -r 1.395.2.344 -r 1.395.2.345 src/summaryview.c;  cvs diff -u -r 1.68.2.41 -r 1.68.2.42 src/summaryview.h;  ) > 3.1.0cvs68.patchset
 ( cvs diff -u -r 1.14.2.13 -r 1.14.2.14 src/vcard.c;  ) > 3.1.0cvs69.patchset
 ( cvs diff -u -r 1.1.2.22 -r 1.1.2.23 src/prefs_receive.c;  ) > 3.1.0cvs70.patchset
+( cvs diff -u -r 1.36.2.130 -r 1.36.2.131 src/common/utils.c;  ) > 3.1.0cvs71.patchset
index f9dfe26828952741b5672061841f66797d5c8ad3..b7984d1dc6f9ebb6e4877c19eff524232daf7e1f 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=1
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=70
+EXTRA_VERSION=71
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 84d54c5506841985813d26c31f71c1dcf73e8baa..69a3fe766aad9baf87a02f810a7fdf57ee2decd2 100644 (file)
@@ -520,18 +520,21 @@ gpointer my_memmem(gconstpointer haystack, size_t haystacklen,
        const gchar *haystack_ = (const gchar *)haystack;
        const gchar *needle_ = (const gchar *)needle;
        const gchar *haystack_cur = (const gchar *)haystack;
+       size_t haystack_left = haystacklen;
 
        if (needlelen == 1)
                return memchr(haystack_, *needle_, haystacklen);
 
-       while ((haystack_cur = memchr(haystack_cur, *needle_, haystacklen))
+       while ((haystack_cur = memchr(haystack_cur, *needle_, haystack_left))
               != NULL) {
                if (haystacklen - (haystack_cur - haystack_) < needlelen)
                        break;
                if (memcmp(haystack_cur + 1, needle_ + 1, needlelen - 1) == 0)
                        return (gpointer)haystack_cur;
-               else
+               else{
                        haystack_cur++;
+                       haystack_left = haystacklen - (haystack_cur - haystack_);
+               }
        }
 
        return NULL;