Skip to content
Snippets Groups Projects
Commit beca0ae0 authored by Andrew Ballance's avatar Andrew Ballance Committed by Frieder Schrempf
Browse files

fs/ntfs3: Check if more than chunk-size bytes are written


[ Upstream commit 9931122d ]

A incorrectly formatted chunk may decompress into
more than LZNT_CHUNK_SIZE bytes and a index out of bounds
will occur in s_max_off.

Signed-off-by: default avatarAndrew Ballance <andrewjballance@gmail.com>
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 20aeac41
No related branches found
No related tags found
1 merge request!180🤖 Sync Bot: Update v6.1-ktn to Latest Stable Kernel (v6.1.124)
...@@ -236,6 +236,9 @@ static inline ssize_t decompress_chunk(u8 *unc, u8 *unc_end, const u8 *cmpr, ...@@ -236,6 +236,9 @@ static inline ssize_t decompress_chunk(u8 *unc, u8 *unc_end, const u8 *cmpr,
/* Do decompression until pointers are inside range. */ /* Do decompression until pointers are inside range. */
while (up < unc_end && cmpr < cmpr_end) { while (up < unc_end && cmpr < cmpr_end) {
// return err if more than LZNT_CHUNK_SIZE bytes are written
if (up - unc > LZNT_CHUNK_SIZE)
return -EINVAL;
/* Correct index */ /* Correct index */
while (unc + s_max_off[index] < up) while (unc + s_max_off[index] < up)
index += 1; index += 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment