tony2001                Fri Sep  8 20:23:05 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/date/lib       parse_date.c 
  Log:
  MFh: fix #38721 (date_parse() invalid read)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.c?r1=1.29.2.30.2.5&r2=1.29.2.30.2.6&diff_format=u
Index: php-src/ext/date/lib/parse_date.c
diff -u php-src/ext/date/lib/parse_date.c:1.29.2.30.2.5 
php-src/ext/date/lib/parse_date.c:1.29.2.30.2.6
--- php-src/ext/date/lib/parse_date.c:1.29.2.30.2.5     Wed Sep  6 07:34:41 2006
+++ php-src/ext/date/lib/parse_date.c   Fri Sep  8 20:22:47 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: parse_date.c,v 1.29.2.30.2.5 2006/09/06 07:34:41 derick Exp $ */
+/* $Id: parse_date.c,v 1.29.2.30.2.6 2006/09/08 20:22:47 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