From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C623CD13DA for ; Sun, 17 Sep 2023 20:03:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240339AbjIQUDU (ORCPT ); Sun, 17 Sep 2023 16:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240444AbjIQUC6 (ORCPT ); Sun, 17 Sep 2023 16:02:58 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 755A8137 for ; Sun, 17 Sep 2023 13:02:51 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0285C433CC; Sun, 17 Sep 2023 20:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1694980971; bh=0bwpiE+GFwfeVeM2cyCfqyqLAivomrjc2cAC/CmkcNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I3ApAOVNYDZCylVoLY5Oxvgb1X7K3+aowwdH2etghwQ3A/gg6z9QQVqDCl1LXrMuC QIp0CnCCTVc3GyErkdygubExUPgRCs9D3kKhHf0gubutAh+VVp+Al4UpqZ7uGbkK81 wHWQ93UVB/d+mOGYiN+UtjM1ArJfWovEmNKXt370= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Konstantin Meskhidze , Masahiro Yamada , Sasha Levin , Ivanov Mikhail Subject: [PATCH 6.1 062/219] kconfig: fix possible buffer overflow Date: Sun, 17 Sep 2023 21:13:09 +0200 Message-ID: <20230917191043.251193096@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230917191040.964416434@linuxfoundation.org> References: <20230917191040.964416434@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Konstantin Meskhidze [ Upstream commit a3b7039bb2b22fcd2ad20d59c00ed4e606ce3754 ] Buffer 'new_argv' is accessed without bound check after accessing with bound check via 'new_argc' index. Fixes: e298f3b49def ("kconfig: add built-in function support") Co-developed-by: Ivanov Mikhail Signed-off-by: Konstantin Meskhidze Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/kconfig/preprocess.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c index 748da578b418c..d1f5bcff4b62d 100644 --- a/scripts/kconfig/preprocess.c +++ b/scripts/kconfig/preprocess.c @@ -396,6 +396,9 @@ static char *eval_clause(const char *str, size_t len, int argc, char *argv[]) p++; } + + if (new_argc >= FUNCTION_MAX_ARGS) + pperror("too many function arguments"); new_argv[new_argc++] = prev; /* -- 2.40.1