Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: fix timestamp validation (#4356)
* cli: fix timestamp validation 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 Signed-off-by: Paul Eggert <[email protected]> * cli: pass clang-format check Adjust patch to pass clang-format. Fixes: #4355 Signed-off-by: Paul Eggert <[email protected]> * cli: fix off-by-one-hour error if DST Don't tell mktime that standard time is in effect. This fixes a bug where the timestamp is off by an hour when daylight saving time is in effect. (The issue is also present in the devel branch, which uses strftime %s and which therefore has the same bug.) --------- Signed-off-by: Paul Eggert <[email protected]>
- Loading branch information