mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
fs/ntfs3: Fix a couple integer overflows on 32bit systems
On 32bit systems the "off + sizeof(struct NTFS_DE)" addition can
have an integer wrapping issue. Fix it by using size_add().
Fixes: 82cae269cf ("fs/ntfs3: Add initialization of super block")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
b432163ebd
commit
5ad414f4df
|
|
@ -618,7 +618,7 @@ static bool index_hdr_check(const struct INDEX_HDR *hdr, u32 bytes)
|
|||
u32 off = le32_to_cpu(hdr->de_off);
|
||||
|
||||
if (!IS_ALIGNED(off, 8) || tot > bytes || end > tot ||
|
||||
off + sizeof(struct NTFS_DE) > end) {
|
||||
size_add(off, sizeof(struct NTFS_DE)) > end) {
|
||||
/* incorrect index buffer. */
|
||||
return false;
|
||||
}
|
||||
|
|
@ -736,7 +736,7 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx,
|
|||
if (end > total)
|
||||
return NULL;
|
||||
|
||||
if (off + sizeof(struct NTFS_DE) > end)
|
||||
if (size_add(off, sizeof(struct NTFS_DE)) > end)
|
||||
return NULL;
|
||||
|
||||
e = Add2Ptr(hdr, off);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user