]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
smb: client: compress: fix counting in LZ77 match finding
authorEnzo Matsumiya <ematsumiya@suse.de>
Mon, 13 Apr 2026 19:07:08 +0000 (16:07 -0300)
committerSteve French <stfrench@microsoft.com>
Wed, 22 Apr 2026 14:55:34 +0000 (09:55 -0500)
commit20d4f9efe008be1b673f43d38d3d99fb1fd4cd68
tree688a12e9c7c521e24c91a67fe7c546048f80a2c9
parent4c221711b23745e2fb961ee517e9ed96ce76f9cb
smb: client: compress: fix counting in LZ77 match finding

- lz77_match_len() increments @cur before checking for equality,
  leading to off-by-one match len in some cases.

  Fix by moving pointers increment to inside the loop.
  Also rename @wnd arg to @match (more accurate name).
- both lz77_match_len() and lz77_compress() checked for
  "buf + step < end" when the correct is "<=" for such cases.

Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/compress/lz77.c