summaryrefslogtreecommitdiff
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
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
-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 6dd77ef4..ae1154d4 100644
--- a/regress/unittests/conversion/tests.c
+++ b/regress/unittests/conversion/tests.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tests.c,v 1.1 2017/03/14 01:20:29 dtucker Exp $ */
+/* $OpenBSD: tests.c,v 1.2 2019/06/14 04:03:48 djm Exp $ */
/*
* Regress test for conversions
*
@@ -40,6 +40,8 @@ tests(void)
ASSERT_LONG_EQ(convtime("-9d"), -1);
/* overflow */
+ snprintf(buf, sizeof buf, "%llu", (unsigned long long)LONG_MAX);
+ ASSERT_LONG_EQ(convtime(buf), -1);
snprintf(buf, sizeof buf, "%llu", (unsigned long long)LONG_MAX + 1);
ASSERT_LONG_EQ(convtime(buf), -1);