Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crashes/freezes in VSS stripping code (#913)
* Fix VSS stripping behavior when headers span >1 network block. When VSS header data straddles multiple network blocks (i.e. got < bsidsize in bfile_write_vss_strip()), the pointer arithmatic when memcpy()ing the next block is incorrect. Since sid is a pointer to a structure, each addition by 1 increases the pointer address by sizeof(*sid); therefore, when sidlen > 0, the memcpy() unintentionally overwrites part of the struct BFILE it lives within or the memory situated after it. Casting sid to a char* in the memcpy() causes the addition to advance the pointer by single bytes as intended. * Don't hang when stripping VSS data from files with an empty stream. When stripping VSS data, an empty stream that has additional data following it will currently cause an infinite loop in bfile_write_vss_strip(). When encountering an empty stream, attempt to start reading a new VSS header instead. --------- Co-authored-by: Ben Winslow <[email protected]>
- Loading branch information