Skip to content

Commit a13e942

Browse files
ematsumiyasmfrench
authored andcommitted
smb: client: compress: fix bad encoding on last LZ77 flag
End-of-stream flag could lead to UB because of int promotion (overwriting signed bit). Fix it by changing operand from '1' to '1UL'. Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent c4d3fc5 commit a13e942

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/smb/client/compress/lz77.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ noinline int lz77_compress(const void *src, u32 slen, void *dst, u32 *dlen)
221221
}
222222

223223
flag <<= (32 - flag_count);
224-
flag |= (1 << (32 - flag_count)) - 1;
224+
flag |= (1UL << (32 - flag_count)) - 1;
225225
lz77_write32(flag_pos, flag);
226226

227227
*dlen = dstp - dst;

0 commit comments

Comments
 (0)