diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2011-01-13 02:01:17 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 17:03:24 +0100 |
commit | 8218a437234309faa5725f82c33c3523788d5f68 (patch) | |
tree | 9d21b42e47fa5a450df28246c4d26221d6ef6105 /lib/decompress_unlzma.c | |
parent | Decompressors: remove unused function from lib/decompress_unlzma.c (diff) | |
download | linux-8218a437234309faa5725f82c33c3523788d5f68.tar.xz linux-8218a437234309faa5725f82c33c3523788d5f68.zip |
Decompressors: fix header validation in decompress_unlzma.c
Validation of header.pos calls error() but doesn't make the function
return to indicate an error to the caller. Instead the decoding is
attempted with invalid header.pos. This fixes it.
Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Alain Knaff <alain@knaff.lu>
Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/decompress_unlzma.c')
-rw-r--r-- | lib/decompress_unlzma.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c index 48173594ce01..696c34a274cf 100644 --- a/lib/decompress_unlzma.c +++ b/lib/decompress_unlzma.c @@ -574,8 +574,10 @@ STATIC inline int INIT unlzma(unsigned char *buf, int in_len, ((unsigned char *)&header)[i] = *rc.ptr++; } - if (header.pos >= (9 * 5 * 5)) + if (header.pos >= (9 * 5 * 5)) { error("bad header"); + goto exit_1; + } mi = 0; lc = header.pos; |