lh5_extract: fix out of bounds array access

I extracted the image of a bios from a flash chip and bios_extract fails
to process it because the lh5 implementation cannot uncompress it.

When adding the right boundary check before the actual processing the
failure to extract is noticed instead of producing a segfault. So at
least all parts that are placed later in the bios image can be
extracted, too.

Change-Id: Iefd7dcf9853271315c2644207402d35026f66a6e
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Reviewed-on: http://review.coreboot.org/10519
Tested-by: build bot (Jenkins)
Reviewed-by: Idwer Vollering <vidwer@gmail.com>
1 file changed