From: Rich Felker Date: Thu, 8 Aug 2019 01:35:28 +0000 (-0400) Subject: in clock_getres, check for null pointer before storing result X-Git-Tag: v1.1.24~46 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0847902ab99065a48f9bd3729b6e676288dfd69e;p=oweals%2Fmusl.git in clock_getres, check for null pointer before storing result POSIX allows a null pointer, in which case the function only checks the validity of the clock id argument. --- diff --git a/src/time/clock_getres.c b/src/time/clock_getres.c index f0f41cf9..81c67037 100644 --- a/src/time/clock_getres.c +++ b/src/time/clock_getres.c @@ -8,7 +8,7 @@ int clock_getres(clockid_t clk, struct timespec *ts) if (SYS_clock_getres != SYS_clock_getres_time64) { long ts32[2]; int r = __syscall(SYS_clock_getres, clk, ts32); - if (!r) { + if (!r && ts) { ts->tv_sec = ts32[0]; ts->tv_nsec = ts32[1]; }