Skip to content

Commit 8f9b54a

Browse files
Larhzutorvalds
authored andcommitted
Decompressors: check for write errors in decompress_unlzo.c
The return value of flush() is not checked in unlzo(). This means that the decompressor won't stop even if the caller doesn't want more data. This can happen e.g. with a corrupt LZO-compressed initramfs image. Signed-off-by: Lasse Collin <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Alain Knaff <[email protected]> Cc: Albin Tonnerre <[email protected]> Cc: Phillip Lougher <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent eb0cf3e commit 8f9b54a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/decompress_unlzo.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ STATIC inline int INIT unlzo(u8 *input, int in_len,
187187
}
188188
}
189189

190-
if (flush)
191-
flush(out_buf, dst_len);
190+
if (flush && flush(out_buf, dst_len) != dst_len)
191+
goto exit_2;
192192
if (output)
193193
out_buf += dst_len;
194194
if (posp)

0 commit comments

Comments
 (0)