mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-16 01:05:15 +08:00
1 parent
f14ab20efd
commit
4d1e4e58f0
2 files changed
+16
No files matched your search
@@ -1115,6 +1115,16 @@ rt_err_t lwp_signal_action(struct rt_lwp *lwp, int signo,
|
||||
rt_list_t *thread_list;
|
||||
rt_err_t ret = RT_EOK;
|
||||
|
||||
/*
|
||||
* Signal numbers are 1-based. valid_signo_check() accepts 0 for the
|
||||
* kill(pid, 0) probe, so reject it here as well before using signo - 1
|
||||
* to index sig_action[].
|
||||
*/
|
||||
if (signo <= 0 || valid_signo_check(signo))
|
||||
{
|
||||
return -RT_EINVAL;
|
||||
}
|
||||
|
||||
if (lwp)
|
||||
{
|
||||
/** acquire READ access to lwp */
|
||||
|
||||
@@ -50,6 +50,12 @@ sysret_t sys_sigaction(int sig, const struct k_sigaction *act,
|
||||
struct lwp_sigaction kact, *pkact = RT_NULL;
|
||||
struct lwp_sigaction koact, *pkoact = RT_NULL;
|
||||
|
||||
/* Reject out-of-range signal numbers before indexing the action arrays. */
|
||||
if (sig <= 0 || (unsigned long)sig > _LWP_NSIG)
|
||||
{
|
||||
SET_ERRNO(EINVAL);
|
||||
goto out;
|
||||
}
|
||||
if (!sigsetsize)
|
||||
{
|
||||
SET_ERRNO(EINVAL);
|
||||
|
||||
Reference in new issue
Block a user