glusterfs icon indicating copy to clipboard operation
glusterfs copied to clipboard

cli: fix timestamp validation

Open eggert opened this issue 3 months ago • 5 comments

cli/src/cli-cmd-parser.c's config_parse was calling strftime with a struct tm that may have tm_year that is out of range for strftime, yielding unspecified and/or undefined behavior. Fix this by using mktime instead of strftime, as mktime's behavior is well-defined for out-of-range values. This also fixes a portability issue with strftime %s and time zones.

Fixes: #4355

eggert avatar May 23 '24 21:05 eggert