upstream: check for convtime() refusing to accept times that

resolve to LONG_MAX Reported by Kirk Wolf bz2977; ok dtucker

OpenBSD-Regress-ID: 15c9fe87be1ec241d24707006a31123d3a3117e0
This commit is contained in:
djm@openbsd.org 2019-06-14 04:03:48 +00:00 committed by Damien Miller
parent e5cccb2410
commit 99bcbbc77f
1 changed files with 3 additions and 1 deletions

View File

@ -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);