tony2001                Fri Sep  8 20:22:24 2006 UTC

  Modified files:              
    /php-src/ext/date/lib       parse_date.c 
  Log:
  fix #38721 (date_parse() invalid read)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.c?r1=1.67&r2=1.68&diff_format=u
Index: php-src/ext/date/lib/parse_date.c
diff -u php-src/ext/date/lib/parse_date.c:1.67 
php-src/ext/date/lib/parse_date.c:1.68
--- php-src/ext/date/lib/parse_date.c:1.67      Wed Sep  6 07:33:59 2006
+++ php-src/ext/date/lib/parse_date.c   Fri Sep  8 20:22:23 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: parse_date.c,v 1.67 2006/09/06 07:33:59 derick Exp $ */
+/* $Id: parse_date.c,v 1.68 2006/09/08 20:22:23 tony2001 Exp $ */
 
 #include "timelib.h"
 
@@ -22140,13 +22140,15 @@
        in.errors->error_count = 0;
        in.errors->error_messages = NULL;
 
-       while (isspace(*s) && s < e) {
-               s++;
-       }
-       while (isspace(*e) && e > s) {
-               e--;
-       }
-       if (e - s < 1) {
+       if (len > 0) {
+               while (isspace(*s) && s < e) {
+                       s++;
+               }
+               while (isspace(*e) && e > s) {
+                       e--;
+               }
+       }  
+       if (e - s < 1){
                in.time = timelib_time_ctor();
                add_error(&in, "Empty string");
                if (errors) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to