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 075856FC9 for ; Sun, 17 Sep 2023 19:38:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69461C433C8; Sun, 17 Sep 2023 19:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1694979536; bh=5YcyLFBsZWDYFPNRrf88SDokjBAls2eW3zzPCfaCRM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hcuEq+XIDcp10h7X7qT5lqWEbiAU6PYp7k02kh/ZYsXXzh7MUpPdVwXSPRNwYrT9M hk8uYifyqubqkeG+YghrUXG4UmEN5K13A3/b182yqIdqkxSEhy9LHtyIAelexaYX65 K07EVcGgPypGtMwHwerAZnfyxOuBIvvCAFvywMlI= 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.10 334/406] kconfig: fix possible buffer overflow Date: Sun, 17 Sep 2023 21:13:08 +0200 Message-ID: <20230917191110.103868185@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230917191101.035638219@linuxfoundation.org> References: <20230917191101.035638219@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.10-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