fix #38721 (date_parse() invalid read)

This commit is contained in:
Antony Dovgal 2006-09-08 20:22:23 +00:00
parent 49f7759c27
commit cb04bb6a4f

View File

@ -22140,13 +22140,15 @@ timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container
in.errors->error_count = 0; in.errors->error_count = 0;
in.errors->error_messages = NULL; in.errors->error_messages = NULL;
while (isspace(*s) && s < e) { if (len > 0) {
s++; while (isspace(*s) && s < e) {
} s++;
while (isspace(*e) && e > s) { }
e--; while (isspace(*e) && e > s) {
} e--;
if (e - s < 1) { }
}
if (e - s < 1){
in.time = timelib_time_ctor(); in.time = timelib_time_ctor();
add_error(&in, "Empty string"); add_error(&in, "Empty string");
if (errors) { if (errors) {