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 E16FAC41513 for ; Mon, 24 Jul 2023 01:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231486AbjGXB2a (ORCPT ); Sun, 23 Jul 2023 21:28:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbjGXB1U (ORCPT ); Sun, 23 Jul 2023 21:27:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA2C34684; Sun, 23 Jul 2023 18:24:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E257B60F5B; Mon, 24 Jul 2023 01:24:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACE44C4339A; Mon, 24 Jul 2023 01:24:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690161851; bh=6iD99Cufx7k5KYzCnecOLp1bh1vCi1+1X8KahPPPjOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FCuqagZmCtGlTsDA2cWRUGUTw6bpGjWR0ZB4jOJI7P7Iefvm+zKxjxNF5DRWoTBGQ 366aSQkSBGqbzajgFBcvtESCbMWWJm7WkS8uSlNSzqPvn+Q4uiorpQOjSh6XCOZeWt 74poXH/OrSPLbt8N3Q9JyxokUhCLAlIzlvl1E75E3WJgbQp8r8ceH9d/qQj1lDlEff d0Tw1wrVlNi1svlgfzQTd9OkQBYk22e2ofAfhc9guutJd8tQGoZIwDQrjqX0QYW/i5 Vp7BYzKyJh3uhsnbNsRmjDCxIrRJKUmkZBoyst/zQt9uY25xDB/kECQLc9T0I7gmw5 symx7X2aW++fw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jan Kara , syzbot+cd311b1e43cc25f90d18@syzkaller.appspotmail.com, Sasha Levin , jack@suse.com Subject: [PATCH AUTOSEL 5.15 18/23] udf: Fix uninitialized array access for some pathnames Date: Sun, 23 Jul 2023 21:23:29 -0400 Message-Id: <20230724012334.2317140-18-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230724012334.2317140-1-sashal@kernel.org> References: <20230724012334.2317140-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.15.121 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Kara [ Upstream commit 028f6055c912588e6f72722d89c30b401bbcf013 ] For filenames that begin with . and are between 2 and 5 characters long, UDF charset conversion code would read uninitialized memory in the output buffer. The only practical impact is that the name may be prepended a "unification hash" when it is not actually needed but still it is good to fix this. Reported-by: syzbot+cd311b1e43cc25f90d18@syzkaller.appspotmail.com Link: https://lore.kernel.org/all/000000000000e2638a05fe9dc8f9@google.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin --- fs/udf/unicode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c index 622569007b530..2142cbd1dde24 100644 --- a/fs/udf/unicode.c +++ b/fs/udf/unicode.c @@ -247,7 +247,7 @@ static int udf_name_from_CS0(struct super_block *sb, } if (translate) { - if (str_o_len <= 2 && str_o[0] == '.' && + if (str_o_len > 0 && str_o_len <= 2 && str_o[0] == '.' && (str_o_len == 1 || str_o[1] == '.')) needsCRC = 1; if (needsCRC) { -- 2.39.2