summaryrefslogtreecommitdiff
path: root/regress/unittests
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-06-14 04:03:48 +0000
committerDamien Miller <djm@mindrot.org>2019-06-19 12:21:40 +1000
commit99bcbbc77fbd5a5027031f42a5931b21b07c947e (patch)
tree971b943d8bb0a43f4d632053f446d5dc09427b24 /regress/unittests
parente5cccb2410247c9b8151b9510a876abdf5424b24 (diff)
upstream: check for convtime() refusing to accept times that
resolve to LONG_MAX Reported by Kirk Wolf bz2977; ok dtucker OpenBSD-Regress-ID: 15c9fe87be1ec241d24707006a31123d3a3117e0
Diffstat (limited to 'regress/unittests')
-rw-r--r--regress/unittests/conversion/tests.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/regress/unittests/conversion/tests.c b/regress/unittests/conversion/tests.c
index 6dd77ef42..ae1154d42 100644
--- a/regress/unittests/conversion/tests.c
+++ b/regress/unittests/conversion/tests.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tests.c,v 1.1 2017/03/14 01:20:29 dtucker Exp $ */ 1/* $OpenBSD: tests.c,v 1.2 2019/06/14 04:03:48 djm Exp $ */
2/* 2/*
3 * Regress test for conversions 3 * Regress test for conversions
4 * 4 *
@@ -40,6 +40,8 @@ tests(void)
40 ASSERT_LONG_EQ(convtime("-9d"), -1); 40 ASSERT_LONG_EQ(convtime("-9d"), -1);
41 41
42 /* overflow */ 42 /* overflow */
43 snprintf(buf, sizeof buf, "%llu", (unsigned long long)LONG_MAX);
44 ASSERT_LONG_EQ(convtime(buf), -1);
43 snprintf(buf, sizeof buf, "%llu", (unsigned long long)LONG_MAX + 1); 45 snprintf(buf, sizeof buf, "%llu", (unsigned long long)LONG_MAX + 1);
44 ASSERT_LONG_EQ(convtime(buf), -1); 46 ASSERT_LONG_EQ(convtime(buf), -1);
45 47