Skip to content

Commit e6e8751

Browse files
llmikegitster
authored andcommitted
date.c: fix unsigned time_t comparison
tm_to_time_t() returns (time_t)-1 when it sees an error. On platforms with unsigned time_t, this value will be larger than any valid timestamp and will break the "Is this older than 10 days in the future?" check. Signed-off-by: Mike Gorchak <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4dac067 commit e6e8751

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static int is_date(int year, int month, int day, struct tm *now_tm, time_t now,
383383
* sense to specify timestamp way into the future. Make
384384
* sure it is not later than ten days from now...
385385
*/
386-
if (now + 10*24*3600 < specified)
386+
if ((specified != -1) && (now + 10*24*3600 < specified))
387387
return 0;
388388
tm->tm_mon = r->tm_mon;
389389
tm->tm_mday = r->tm_mday;

0 commit comments

Comments
 (0)