cvs: pecl /phar zip.c
| From: | Greg Beaver | Date: | Wed, 30 Apr 2008 23:49:08 +0000 |
| Subject: | cvs: pecl /phar zip.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-10669@lists.php.net to get a copy of this message | ||
cellog Wed Apr 30 23:49:08 2008 UTC
Modified files:
/pecl/phar zip.c
Log:
fix possible read past end of buffer by ridiculously stupid convoluted logic (I wrote it, I can
call it that) reported by valgrind
http://cvs.php.net/viewvc.cgi/pecl/phar/zip.c?r1=1.38&r2=1.39&diff_format=u
Index: pecl/phar/zip.c
diff -u pecl/phar/zip.c:1.38 pecl/phar/zip.c:1.39
--- pecl/phar/zip.c:1.38 Sun Apr 27 07:04:55 2008
+++ pecl/phar/zip.c Wed Apr 30 23:49:08 2008
@@ -175,7 +175,7 @@
}
return FAILURE;
}
- while ((p=(char *) memchr(p + 1, 'P', (size_t)(buf - (p+1) + sizeof(locator) + 65536 - 4
+ 1))) != NULL) {
+ while ((p=(char *) memchr(p + 1, 'P', (size_t) (size - (p + 1 - buf)))) != NULL) {
if (!memcmp(p + 1, "K\5\6", 3)) {
memcpy((void *)&locator, (void *) p, sizeof(locator));
if (locator.centraldisk != 0 || locator.disknumber != 0) {