Skip to content

Commit

Permalink
Set errno in adjtime if delta is too large
Browse files Browse the repository at this point in the history
errno should be set to EINVAL in this case according to adjtime's man
page.
  • Loading branch information
jofrev committed Dec 8, 2022
1 parent 1005b45 commit 60767c2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions components/newlib/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
/*
Expand Down

0 comments on commit 60767c2

Please sign in to comment.