3 @@ -68,15 +68,23 @@ void FAST_FUNC parse_datestr(const char
4 /* else end != NUL and we error out */
8 - if (sscanf(date_str, "%u-%u-%u %u%c", &ptm->tm_year,
9 + if (strchr(date_str, '-')
10 + /* Why strchr('-') check?
11 + * sscanf below will trash ptm->tm_year, this breaks
12 + * if parse_str is "10101010" (iow, "MMddhhmm" form)
13 + * because we destroy year. Do these sscanf
14 + * only if we saw a dash in parse_str.
17 + && (sscanf(date_str, "%u-%u-%u %u%c", &ptm->tm_year,
18 &ptm->tm_mon, &ptm->tm_mday,
22 - || sscanf(date_str, "%u-%u-%u%c", &ptm->tm_year,
24 + || sscanf(date_str, "%u-%u-%u%c", &ptm->tm_year,
25 &ptm->tm_mon, &ptm->tm_mday,
29 ptm->tm_year -= 1900; /* Adjust years */
30 ptm->tm_mon -= 1; /* Adjust month from 1-12 to 0-11 */