Skip to content

Commit 0dc3794

Browse files
heyuanjie87Rbb666
authored andcommitted
[lwp]检查killpg的signo参数的有效性 (#9981)
* [lwp]对检查killpg的signo参数的有效性
1 parent 7d28992 commit 0dc3794

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: components/lwp/lwp_signal.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
#include "sys/signal.h"
2828
#include "syscall_generic.h"
2929

30+
rt_inline rt_err_t valid_signo_check(unsigned long sig)
31+
{
32+
return sig <= _LWP_NSIG ? 0 : -RT_EINVAL;
33+
}
34+
3035
static lwp_siginfo_t siginfo_create(rt_thread_t current, int signo, int code, lwp_siginfo_ext_t ext)
3136
{
3237
lwp_siginfo_t siginfo;
@@ -1432,7 +1437,8 @@ rt_err_t lwp_pgrp_signal_kill(rt_processgroup_t pgrp, long signo, long code,
14321437

14331438
PGRP_ASSERT_LOCKED(pgrp);
14341439

1435-
if (pgrp)
1440+
rc = valid_signo_check(signo);
1441+
if (pgrp && !rc)
14361442
{
14371443
rt_list_for_each_entry(lwp, &pgrp->process, pgrp_node)
14381444
{

0 commit comments

Comments
 (0)