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
20 if (readfile(path, &buf, &size))20 if (readfile(path, &buf, &size))
21 return -1;21 return -1;
22 22
23 if (parse_date(buf, buf2, sizeof(buf2)))23 if (parse_date(buf, buf2, sizeof(buf2)) > 0)
24 result = strtoul(buf2, NULL, 10);24 result = strtoul(buf2, NULL, 10);
25 else25 else
26 result = 0;26 result = 0;