diff --git a/CHANGES.txt b/CHANGES.txt index 48f1f11a51ef70cb98369f36fd5fbcae9ae25c17..ab39b5b8da641564077c4c05b2c640343a7b109b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -94,6 +94,9 @@ for split image files. Patch by Christopher Siwy. 5/3/09: Update: Abstracted name comparison to file system-specific function. +5/4/09: Bug Fix: NTFS compression infinite loop fix by Jamie Butler. +Bug 2786963) + ---------------- VERSION 3.0.0 -------------- 0/00/00: Update: Many, many, many API changes. diff --git a/tsk3/fs/ntfs.c b/tsk3/fs/ntfs.c index b8c705229395d2ce8debe24a7234e69bb74e6dfb..80b2ef2254c1b8a82fb07257757a650d7f41674a 100644 --- a/tsk3/fs/ntfs.c +++ b/tsk3/fs/ntfs.c @@ -1508,6 +1508,14 @@ ntfs_file_read_special(const TSK_FS_ATTR * a_fs_attr, else { cpylen = a_len - buf_idx; } + // Make sure not to return more bytes than are in the file + if (cpylen > + (a_fs_attr->fs_file->meta->size - (a_offset + + buf_idx))) + cpylen = + (a_fs_attr->fs_file->meta->size - (a_offset + + buf_idx)); + memcpy(&a_buf[buf_idx], &comp.uncomp_buf[byteoffset], cpylen);