]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: lzo - Fix compression buffer overrun
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 27 Feb 2025 09:04:46 +0000 (17:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:40:08 +0000 (14:40 +0200)
commita98bd864e16f91c70b2469adf013d713d04d1d13
tree46b33869d3a8cd34229865ff0e6604f4acef8997
parent89172666228de1cefcacf5bc6f61c6281751d2ed
crypto: lzo - Fix compression buffer overrun

[ Upstream commit cc47f07234f72cbd8e2c973cdbf2a6730660a463 ]

Unlike the decompression code, the compression code in LZO never
checked for output overruns.  It instead assumes that the caller
always provides enough buffer space, disregarding the buffer length
provided by the caller.

Add a safe compression interface that checks for the end of buffer
before each write.  Use the safe interface in crypto/lzo.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
crypto/lzo-rle.c
crypto/lzo.c
include/linux/lzo.h
lib/lzo/Makefile
lib/lzo/lzo1x_compress.c
lib/lzo/lzo1x_compress_safe.c [new file with mode: 0644]