mirror of
https://github.com/armbian/build.git
synced 2025-08-15 15:46:58 +02:00
36 lines
1.1 KiB
Diff
36 lines
1.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Alex Shumsky <alexthreed@gmail.com>
|
|
Date: Fri, 14 Jun 2024 19:01:48 +0000
|
|
Subject: fs/btrfs: fix out of bounds write
|
|
|
|
Signed-off-by: Alex Shumsky <alexthreed@gmail.com>
|
|
---
|
|
fs/btrfs/inode.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
|
|
index 111111111111..222222222222 100644
|
|
--- a/fs/btrfs/inode.c
|
|
+++ b/fs/btrfs/inode.c
|
|
@@ -640,7 +640,7 @@ static int read_and_truncate_page(struct btrfs_path *path,
|
|
extent_type = btrfs_file_extent_type(leaf, fi);
|
|
if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
|
|
ret = btrfs_read_extent_inline(path, fi, buf);
|
|
- memcpy(dest, buf + page_off, min(page_len, ret));
|
|
+ memcpy(dest, buf + page_off, min(min(page_len, ret), len));
|
|
free(buf);
|
|
return len;
|
|
}
|
|
@@ -652,7 +652,7 @@ static int read_and_truncate_page(struct btrfs_path *path,
|
|
free(buf);
|
|
return ret;
|
|
}
|
|
- memcpy(dest, buf + page_off, page_len);
|
|
+ memcpy(dest, buf + page_off, min(page_len, len));
|
|
free(buf);
|
|
return len;
|
|
}
|
|
--
|
|
Armbian
|
|
|