From: Lasse Collin Date: Fri, 11 Nov 2011 13:35:05 +0000 (+0100) Subject: Decompressors: check for write errors in unlzo.c X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1fdb4c9a338713db7abda4dbe81fb09d61e16699;p=xen.git Decompressors: check for write errors in unlzo.c From: Lasse Collin 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 Signed-off-by: Jan Beulich Acked-by: Keir Fraser Committed-by: Jan Beulich --- diff --git a/xen/common/unlzo.c b/xen/common/unlzo.c index 08117e244e..f3fb098f31 100644 --- a/xen/common/unlzo.c +++ b/xen/common/unlzo.c @@ -202,8 +202,8 @@ STATIC int INIT unlzo(u8 *input, unsigned int in_len, } } - if (flush) - flush(out_buf, dst_len); + if (flush && flush(out_buf, dst_len) != dst_len) + goto exit_2; if (output) out_buf += dst_len; if (posp)