diff options
author | Antony Dovgal <tony2001@php.net> | 2006-09-08 20:22:47 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2006-09-08 20:22:47 +0000 |
commit | 51fbffba2f0c6df94dfa94ecb824771ce8500ac4 (patch) | |
tree | 4c58fc38c5e84ba6e62fa97e8ac7ac6db8c1bb46 | |
parent | 5c6f43831917196912006c0246c6e3f4c7324b01 (diff) | |
download | php-git-51fbffba2f0c6df94dfa94ecb824771ce8500ac4.tar.gz |
MFh: fix #38721 (date_parse() invalid read)
-rw-r--r-- | ext/date/lib/parse_date.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 740a33c385..dececa88c6 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -22140,13 +22140,15 @@ timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container 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) { |