Skip to content
Commit f4cfb18d authored by Volodymyr G. Lukiianyk's avatar Volodymyr G. Lukiianyk Committed by Linus Torvalds
Browse files

uclinux: fix gzip header parsing in binfmt_flat.c



There are off-by-one errors in decompress_exec() when calculating the length of
optional "original file name" and "comment" fields: the "ret" index is not
incremented when terminating '\0' character is reached. The check of the buffer
overflow (after an "extra-field" length was taken into account) is also fixed.

I've encountered this off-by-one error when tried to reuse
gzip-header-parsing part of the decompress_exec() function.  There was an
"original file name" field in the payload (with miscalculated length) and
zlib_inflate() returned Z_DATA_ERROR.  But after the fix similar to this
one all worked fine.

Signed-off-by: default avatarVolodymyr G Lukiianyk <volodymyrgl@gmail.com>
Acked-by: default avatarGreg Ungerer <gerg@snapgear.com>
Acked-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0c6aa263
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment