Skip to content
  • Jeff King's avatar
    date: check date overflow against time_t · 7ca36d93
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When we check whether a timestamp has overflowed, we check
    only against ULONG_MAX, meaning that strtoul has overflowed.
    However, we also feed these timestamps to system functions
    like gmtime, which expect a time_t. On many systems, time_t
    is actually smaller than "unsigned long" (e.g., because it
    is signed), and we would overflow when using these
    functions.  We don't know the actual size or signedness of
    time_t, but we can easily check for truncation with a simple
    assignment.
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    7ca36d93