From 96412e28e5c7ac2d15f1cff8c825330bbb60976e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Tue, 10 May 2022 10:30:24 +0200 Subject: [PATCH] Fixed possible out-of-buffer condition in ntfsck A bad usa_count could lead to an out-of-buffer condition. Just avoid the issue and report the error, still not fix it. --- ntfsprogs/ntfsck.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsck.c b/ntfsprogs/ntfsck.c index d49f3f96..8c126411 100644 --- a/ntfsprogs/ntfsck.c +++ b/ntfsprogs/ntfsck.c @@ -616,7 +616,8 @@ static BOOL check_file_record(u8 *buffer, u16 buflen) // Remove update seq & check it. usa = *(u16*)(buffer+usa_ofs); // The value that should be at the end of every sector. - assert_u32_equal(usa_count-1, buflen/NTFS_BLOCK_SIZE, "USA length"); + if (assert_u32_equal(usa_count-1, buflen/NTFS_BLOCK_SIZE, "USA length")) + return (1); for (i=1;i