summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/zfs/zle.c4
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;
}