time-util: fix buffer-over-run

Fixes #23928.
This commit is contained in:
Yu Watanabe
2022-07-08 16:09:46 +02:00
committed by Lennart Poettering
parent ef8304de53
commit 9102c625a6
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -238,6 +238,11 @@ TEST(format_timespan) {
test_format_timespan_accuracy(1);
test_format_timespan_accuracy(USEC_PER_MSEC);
test_format_timespan_accuracy(USEC_PER_SEC);
/* See issue #23928. */
_cleanup_free_ char *buf;
assert_se(buf = new(char, 5));
assert_se(buf == format_timespan(buf, 5, 100005, 1000));
}
TEST(verify_timezone) {