From 2cda5f6169e4a03e9860d315e7b4a7b0d61ca11f Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sun, 12 Apr 2026 16:24:53 +0200 Subject: [PATCH] compress: limit the output to dst_max bytes with LZ4 if set We already do that with other algorithms, so let's make decompress_blob_lz4() consistent with the rest. --- src/basic/compress.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/basic/compress.c b/src/basic/compress.c index 251eb02fbb..b2a42f44e9 100644 --- a/src/basic/compress.c +++ b/src/basic/compress.c @@ -739,6 +739,8 @@ static int decompress_blob_lz4( size = unaligned_read_le64(src); if (size < 0 || (unsigned) size != unaligned_read_le64(src)) return -EFBIG; + if (dst_max > 0 && (size_t) size > dst_max) + return -ENOBUFS; out = greedy_realloc(dst, size, 1); if (!out) return -ENOMEM;