From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52C2E15AD3 for ; Wed, 20 Sep 2023 12:37:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78D46C433C8; Wed, 20 Sep 2023 12:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1695213476; bh=Z/jdZZsworErR6ZoEqqUM9Xrquvk8eQOUz61ldsDV3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZkZcKfQ6fJ7HMqgNxETrffpVgZvBu8lUUdhBgvuZC/nSiexu+AbTQJpeZGPaDN7Lr C7dgtnQx0fOFfPgdsqgaYj3/G4hqhq416nYqlmZFXPLnduzCpQtgxxQ4gpiUN6W+vf 1FCJU/oIBH8TAmB6h78zXsv7Uutb1sXf/KxkHfuE= 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 5.4 252/367] kconfig: fix possible buffer overflow Date: Wed, 20 Sep 2023 13:30:29 +0200 Message-ID: <20230920112905.077676876@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230920112858.471730572@linuxfoundation.org> References: <20230920112858.471730572@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-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