|
Message-ID: <2f7471a2f0ac45f6bfc48191e16b25ec@huawei.com> Date: Fri, 8 May 2020 14:46:56 +0000 From: "zhuyan (M)" <zhuyan34@...wei.com> To: "musl@...ts.openwall.com" <musl@...ts.openwall.com> CC: Zengweilin <zengweilin@...wei.com>, "liucheng (G)" <liucheng32@...wei.com>, "zhuyan (M)" <zhuyan34@...wei.com> Subject: [PATCH] fix coredump when sched_rr_get_interval parameter ts is NULL In function sched_rr_get_interval, there is a risk of null pointer reference. On line 12, when ts is NULL, dereferencing the null pointer will cause the program coredump. Therefore, it must ensure that ts is not empty before use. Signed-off-by: Yan Zhu <zhuyan34@...wei.com> --- src/sched/sched_rr_get_interval.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sched/sched_rr_get_interval.c b/src/sched/sched_rr_get_interval.c index 33a3d1a..3577291 100644 --- a/src/sched/sched_rr_get_interval.c +++ b/src/sched/sched_rr_get_interval.c @@ -9,6 +9,8 @@ int sched_rr_get_interval(pid_t pid, struct timespec *ts) long ts32[2]; int r = __syscall(SYS_sched_rr_get_interval, pid, ts32); if (!r) { + if (ts == NULL) + return -1; ts->tv_sec = ts32[0]; ts->tv_nsec = ts32[1]; } -- 2.24.0
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.