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
23227313a2
commit
5e566c5772
|
@ -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