• Martin Blix Grydeland's avatar
    Handle unformatable VCL_TIME to string conversion failures · 6cb9c766
    Martin Blix Grydeland authored
    For VCL_TIME values that would convert to a year element that can not fit
    in an int, gmtime_r would fail, and VTIM_format() would use random stack
    values when picking weekday and month strings.
    
    This patch changes VTIM_format to return "" when gmtime_r reports
    failures. This way the API is not changed. Callers can test for empty
    string to catch the failure if needed.
    
    VRT_TIME_string is patched to catch the VTIM_format error, and return NULL
    on failure.
    
    Fixes: #3308
    6cb9c766
vtim.c 13.5 KB