diff options
author | Chunwei Chen <[email protected]> | 2018-02-01 15:41:05 -0800 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2018-03-14 16:10:36 -0700 |
commit | 5e566c57726226ceeca09b1eb19cb1c373622763 (patch) | |
tree | d480eaa7ac4c24f7e26e2b0e5ca902350539534f | |
parent | 23227313a2016449176cbfcbae2d4fc463a2bc09 (diff) |
Fix zle_decompress out of bound access
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: loli10K <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes #7099
-rw-r--r-- | module/zfs/zle.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/module/zfs/zle.c b/module/zfs/zle.c index 13c5673fb..613607faa 100644 --- a/module/zfs/zle.c +++ b/module/zfs/zle.c @@ -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; } |