From: "zhuyan (M)" <zhuyan34@huawei.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Cc: Zengweilin <zengweilin@huawei.com>,
"liucheng (G)" <liucheng32@huawei.com>,
"chenzefeng (A)" <chenzefeng2@huawei.com>
Subject: [musl] [PATCH] fix segfault in getitimer when old argument is NULL
Date: Tue, 12 Jan 2021 07:56:58 +0000 [thread overview]
Message-ID: <c7c54510e4b94f5c9105b565b28560f4@huawei.com> (raw)
In-Reply-To: <20210112074221.58076-1-zhuyan34@huawei.com>
When old is NULL, call old->it_interval.tv_sec to dereference a null pointer in getitimer.
The commit 558c01338b0b635632e70af6ec8a484ca70b0328 introduces this problem.
Signed-off-by: Qing Wu <wuqing30@huawei.com>
Signed-off-by: Yan Zhu <zhuyan34@huawei.com>
---
src/signal/getitimer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/signal/getitimer.c b/src/signal/getitimer.c index 36d1eb9d..f6fde204 100644
--- a/src/signal/getitimer.c
+++ b/src/signal/getitimer.c
@@ -6,7 +6,7 @@ int getitimer(int which, struct itimerval *old)
if (sizeof(time_t) > sizeof(long)) {
long old32[4];
int r = __syscall(SYS_getitimer, which, old32);
- if (!r) {
+ if (!r && old) {
old->it_interval.tv_sec = old32[0];
old->it_interval.tv_usec = old32[1];
old->it_value.tv_sec = old32[2];
--
2.12.3
next parent reply other threads:[~2021-01-12 7:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210112074221.58076-1-zhuyan34@huawei.com>
2021-01-12 7:56 ` zhuyan (M) [this message]
2021-01-12 8:58 ` Fangrui Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c7c54510e4b94f5c9105b565b28560f4@huawei.com \
--to=zhuyan34@huawei.com \
--cc=chenzefeng2@huawei.com \
--cc=liucheng32@huawei.com \
--cc=musl@lists.openwall.com \
--cc=zengweilin@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).