From: Frantisek Sumsal Date: Sun, 12 Apr 2026 14:24:53 +0000 (+0200) Subject: compress: limit the output to dst_max bytes with LZ4 if set X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2cda5f6169e4a03e9860d315e7b4a7b0d61ca11f;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/basic/compress.c b/src/basic/compress.c index 251eb02fbb7..b2a42f44e94 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;