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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 DBEE130A9A for ; Tue, 29 Oct 2024 14:02:52 +0100 (CET) Received: (qmail 19769 invoked by uid 550); 29 Oct 2024 13:02:47 -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 19728 invoked from network); 29 Oct 2024 13:02:47 -0000 From: To: CC: Date: Tue, 29 Oct 2024 21:02:34 +0800 Message-ID: <20241029130234.729799-1-lihua.zhao.cn@windriver.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: lqJa8Mu3NjRI4uBG-0uymGkmHIKbU4wx X-Authority-Analysis: v=2.4 cv=dKj0m/Zb c=1 sm=1 tr=0 ts=6720dced cx=c_pps a=/ZJR302f846pc/tyiSlYyQ==:117 a=/ZJR302f846pc/tyiSlYyQ==:17 a=DAUX931o1VcA:10 a=t7CeM3EgAAAA:8 a=7XkbfFqITg_r_JWCTEsA:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-GUID: lqJa8Mu3NjRI4uBG-0uymGkmHIKbU4wx 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_08,2024-10-29_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 mlxlogscore=762 adultscore=0 impostorscore=0 malwarescore=0 bulkscore=0 clxscore=1015 spamscore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2409260000 definitions=main-2410290099 Subject: [musl] [PATCH] set EINVAL for sigismember when sig is invalid From: Lihua Zhao --- src/signal/sigismember.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/signal/sigismember.c b/src/signal/sigismember.c index ab87d622..0b33888c 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; + if (s < 0 || 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