From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 4E10E30B03 for ; Wed, 30 Oct 2024 04:07:41 +0100 (CET) Received: (qmail 13491 invoked by uid 550); 30 Oct 2024 03:07:35 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com x-ms-reactions: disallow Received: (qmail 13453 invoked from network); 30 Oct 2024 03:07:34 -0000 From: To: CC: Date: Wed, 30 Oct 2024 11:07:24 +0800 Message-ID: <20241030030724.733422-1-lihua.zhao.cn@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241029130234.729799-1-lihua.zhao.cn@windriver.com> References: <20241029130234.729799-1-lihua.zhao.cn@windriver.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 1zogX_D2_S7OE_cjcdSYK5Q2ZbrjDdi3 X-Proofpoint-GUID: 1zogX_D2_S7OE_cjcdSYK5Q2ZbrjDdi3 X-Authority-Analysis: v=2.4 cv=T9jeTOKQ c=1 sm=1 tr=0 ts=6721a2ef cx=c_pps a=K4BcnWQioVPsTJd46EJO2w==:117 a=K4BcnWQioVPsTJd46EJO2w==:17 a=DAUX931o1VcA:10 a=t7CeM3EgAAAA:8 a=txbkeM8dsceN3z8ae98A:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-29_20,2024-10-29_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 mlxlogscore=895 priorityscore=1501 impostorscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 clxscore=1015 bulkscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2409260000 definitions=main-2410300023 Subject: [musl] [PATCH v2] signal: set EINVAL for sigismember when sig is invalid From: Lihua Zhao sigismember() forget to set errno when input sig is invalid --- src/signal/sigismember.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/signal/sigismember.c b/src/signal/sigismember.c index ab87d622..3ecd300f 100644 --- a/src/signal/sigismember.c +++ b/src/signal/sigismember.c @@ -1,8 +1,12 @@ #include +#include int sigismember(const sigset_t *set, int sig) { - unsigned s = sig-1; - if (s >= _NSIG-1) return 0; + unsigned s = sig-1U; + if (s >= _NSIG-1) { + errno = EINVAL; + return -1; + } return !!(set->__bits[s/8/sizeof *set->__bits] & 1UL<<(s&8*sizeof *set->__bits-1)); } -- 2.34.1