[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240216232903.work.643-kees@kernel.org>
Date: Fri, 16 Feb 2024 15:29:03 -0800
From: Kees Cook <keescook@...omium.org>
To: Anton Altaparmakov <anton@...era.com>
Cc: Kees Cook <keescook@...omium.org>,
Namjae Jeon <linkinjeon@...nel.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
linux-ntfs-dev@...ts.sourceforge.net,
linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] ntfs: Replace struct ntfs_name 0-sized array with flexible array
ntfs_name::name is used as a destination in memcpy(), so it cannot be a
0-sized array any more. Convert it to a flexible array and annotated
with __counted_by, which matches the allocations.
Signed-off-by: Kees Cook <keescook@...omium.org>
---
Cc: Anton Altaparmakov <anton@...era.com>
Cc: Namjae Jeon <linkinjeon@...nel.org>
Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: linux-ntfs-dev@...ts.sourceforge.net
Cc: linux-hardening@...r.kernel.org
---
fs/ntfs/dir.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ntfs/dir.h b/fs/ntfs/dir.h
index 0e326753df40..cafcd339094c 100644
--- a/fs/ntfs/dir.h
+++ b/fs/ntfs/dir.h
@@ -22,7 +22,7 @@ typedef struct {
MFT_REF mref;
FILE_NAME_TYPE_FLAGS type;
u8 len;
- ntfschar name[0];
+ ntfschar name[] __counted_by(len);
} __attribute__ ((__packed__)) ntfs_name;
/* The little endian Unicode string $I30 as a global constant. */
--
2.34.1
Powered by blists - more mailing lists