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 <behlendorf1@llnl.gov>
Reviewed-by: loli10K <ezomori.nozomu@gmail.com>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes openzfs#7099
  • Loading branch information
davidchenntnx authored and tonyhutter committed Mar 8, 2018
1 parent b2e35ad commit 2a59c28
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 2a59c28

Please sign in to comment.