summaryrefslogtreecommitdiff
path: root/include/linux/timerqueue.h
diff options
context:
space:
mode:
authorEnzo Matsumiya <ematsumiya@suse.de>2026-04-13 16:07:06 -0300
committerSteve French <stfrench@microsoft.com>2026-04-22 09:55:26 -0500
commit4c221711b23745e2fb961ee517e9ed96ce76f9cb (patch)
tree50fead7923b5f343f6b3d0fb48184c90f9fd37a7 /include/linux/timerqueue.h
parenta55a60886e612bedb0e9a402ba0dca544c4c6a51 (diff)
smb: client: compress: fix buffer overrun in lz77_compress()
@dst buffer is allocated with same size as @src, which, for good compression cases, works fine. However, when compression goes bad (e.g. random bytes payloads), the compressed size can increase significantly, and even by stopping the main loop at 7/8 of @slen, writing leftover literals could write past the end of @dst because of LZ77 metadata. To fix this, add lz77_compressed_alloc_size() helper to compute the correct allocation size for @dst, accounting for metadata and worst cast scenario (all literals). While this is overprovisioning memory, it's not only correct, but also allows lz77_compress() main loop to run without ever checking @dst limits (i.e. a perf improvement). Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions