From: David Oberhollenzer Date: Mon, 11 Jul 2016 13:42:20 +0000 (+0200) Subject: mtd-utils: mkfs.jffs2: initialize lzo decompression buffer size X-Git-Tag: v2.0.0-rc1~40 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a6dcd8f3215b435ba21ce26eb230b1484417d1e3;p=mtd-utils.git mtd-utils: mkfs.jffs2: initialize lzo decompression buffer size This fix was initialially part of a patch submitted by Carsten Schlote in January 2009. It didn't get merged back then because of coding style issues and a proposed buffer size change guessed by shotgun debugging. I was unable to reproduce the claimed segfaults in the compression function that lead to the proposed buffer size change. Valgrind did not issue any errors or warnings about the code in question either, so I didn't include the proposed buffer size change. The original patch also added a call to lzo_init(), which (according to LZO documentation & source code) does not actually perform any initialization, but only checks at runtime that the data type sizes and endianness of the library code match those in the caller code and should be unnecessary. Other fixes from the original patch have already been added over the years. Signed-off-by: David Oberhollenzer Signed-off-by: Richard Weinberger --- diff --git a/jffsX-utils/compr_lzo.c b/jffsX-utils/compr_lzo.c index d2e2afc..56aa1b4 100644 --- a/jffsX-utils/compr_lzo.c +++ b/jffsX-utils/compr_lzo.c @@ -73,6 +73,7 @@ static int jffs2_lzo_decompress(unsigned char *data_in, unsigned char *cpage_out int ret; lzo_uint dl; + dl = destlen; ret = lzo1x_decompress_safe(data_in,srclen,cpage_out,&dl,NULL); if (ret != LZO_E_OK || dl != destlen)