]> 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:37:58 +0000 (14:37 +0200)
commit4b173bb2c4665c23f8fcf5241c7b06dfa6b5b111
tree0c3dbb49394b03a6ed241ff6fe3989693c7dec6f
parent2592aeda794c9ea73193effdab69f1cf90d0851a
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]