This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 54c720cc0ee4cd4889b988dacfbdfcc90a7a9d7a Author: ganjing <[email protected]> AuthorDate: Mon Nov 17 21:27:10 2025 +0800 libc/pthread: Check the signal number in pthread_kill(). pthread_kill() passed an invalid signal number to tkill() and took the error from errno, so the call also changed the errno of the caller. Check the signal number first and return EINVAL directly. Assisted-by: Kiro:auto Signed-off-by: ganjing <[email protected]> --- libs/libc/pthread/pthread_kill.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/libc/pthread/pthread_kill.c b/libs/libc/pthread/pthread_kill.c index a9a9d14a905..afdb216898c 100644 --- a/libs/libc/pthread/pthread_kill.c +++ b/libs/libc/pthread/pthread_kill.c @@ -61,9 +61,13 @@ int pthread_kill(pthread_t thread, int signo) { - int ret = tkill((pid_t)thread, signo); + int ret = OK; - if (ret < 0) + if (!GOOD_SIGNO(signo)) + { + ret = EINVAL; + } + else if (tkill((pid_t)thread, signo) < 0) { ret = get_errno(); }
