History

ui-repolist.c: do not return random/stale data from read_agefile

When git/date.c:parse_date() cannot parse its input it returns -1. But read_agefile() checks if the result is different from zero, essentialy returning random data from the date buffer when parsing fails. This patch fixes the issue by verifying that the result from parse_date() is positive.

Lars Hjemli committed 15 years ago

Commit c8ea73c1 parent 9afc8831 file · +1 −1Browse files

Unified · Split

ui-repolist.c+1−1
@@ -20,7 +20,7 @@ time_t read_agefile(char *path) · 19 unmodified lines
2020 if (readfile(path, &buf, &size))
2121 return -1;
2222
23− if (parse_date(buf, buf2, sizeof(buf2)))
23+ if (parse_date(buf, buf2, sizeof(buf2)) > 0)
2424 result = strtoul(buf2, NULL, 10);
2525 else
2626 result = 0;