Skip to content

Commit

Permalink
Fix zle_decompress out of bound access
Browse files Browse the repository at this point in the history
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: loli10K <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes openzfs#7099
  • Loading branch information
davidchenntnx authored and tonyhutter committed Mar 6, 2018
1 parent 135ca27 commit ba3d827
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions module/zfs/zle.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ zle_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n)
while (src < s_end && dst < d_end) {
int len = 1 + *src++;
if (len <= n) {
if (src + len > s_end || dst + len > d_end)
return (-1);
while (len-- != 0)
*dst++ = *src++;
} else {
len -= n;
if (dst + len > d_end)
return (-1);
while (len-- != 0)
*dst++ = 0;
}
Expand Down

0 comments on commit ba3d827

Please sign in to comment.