From df9ace338659e9b1f01d46c26bed371ee21cac59 Mon Sep 17 00:00:00 2001 From: Will Xu Date: Fri, 30 Jun 2023 16:28:06 -0400 Subject: [PATCH] Add nullchecks to clock time functions --- src/system/newlib_stubs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/system/newlib_stubs.c b/src/system/newlib_stubs.c index 6594f78a2..ce4c9d71b 100644 --- a/src/system/newlib_stubs.c +++ b/src/system/newlib_stubs.c @@ -73,6 +73,11 @@ static struct timespec user_time_spec; static int64_t set_microseconds = 0; int clock_settime(clockid_t clock_id, const struct timespec *tp) { + if(tp == NULL) { + errno = EINVAL; + return -1; + } + int retval = -1; switch(clock_id) { @@ -89,6 +94,11 @@ int clock_settime(clockid_t clock_id, const struct timespec *tp) { } int clock_gettime(clockid_t clock_id, struct timespec* tp) { + if(tp == NULL) { + errno = EINVAL; + return -1; + } + struct timeval tv; int retval = -1;