mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
Fix zle_decompress out of bound access
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: loli10K <ezomori.nozomu@gmail.com> Signed-off-by: Chunwei Chen <david.chen@nutanix.com> Closes #7099
This commit is contained in:
parent
d3190c5f29
commit
f108a49236
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user