Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241217131514.3366368-1-lihua.zhao.cn@windriver.com>
Date: Tue, 17 Dec 2024 21:15:14 +0800
From: <lihua.zhao.cn@...driver.com>
To: <musl@...ts.openwall.com>
CC: <lihua.zhao.cn@...driver.com>
Subject: [PATCH] signal: check sigpause() input parameter

From: Lihua Zhao <lihua.zhao.cn@...driver.com>

---
 src/signal/sigpause.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/signal/sigpause.c b/src/signal/sigpause.c
index 363d2fec..a3644792 100644
--- a/src/signal/sigpause.c
+++ b/src/signal/sigpause.c
@@ -1,8 +1,13 @@
 #include <signal.h>
+#include <errno.h>
 
 int sigpause(int sig)
 {
 	sigset_t mask;
+	if (sig < 1 || sig >= _NSIG - 1) {
+		errno = EINVAL;
+		return -1;
+	}
 	sigprocmask(0, 0, &mask);
 	sigdelset(&mask, sig);
 	return sigsuspend(&mask);
-- 
2.43.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.