From aa496e6550bd5ea3336320936098cfd6061f885b Mon Sep 17 00:00:00 2001 From: jofrev Date: Thu, 8 Dec 2022 22:32:31 +0000 Subject: [PATCH] Set errno in adjtime if delta is too large errno should be set to EINVAL in this case according to adjtime's man page. --- components/newlib/time.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/newlib/time.c b/components/newlib/time.c index 638beb19a4..44c4499c14 100644 --- a/components/newlib/time.c +++ b/components/newlib/time.c @@ -123,6 +123,7 @@ int adjtime(const struct timeval *delta, struct timeval *outdelta) int64_t sec = delta->tv_sec; int64_t usec = delta->tv_usec; if(llabs(sec) > ((INT_MAX / 1000000L) - 1L)) { + errno = EINVAL; return -1; } /*