Limit data count in read_spi_trace()

We have a buffer size of 8192 bytes, and each packet is 8 bytes long,
so we need to make sure we don't overflow the buffer.

Coverity CID 146720: Untrusted loop bound

An attacker could control the number of times the loop iterates.

In read_spi_trace: An unscrutinzed value from an untrusted source used
as a loop upper bound (CWE-606)

Change-Id: I7b25d7f471b855fb5787554ae47bf04d0a1d7de0
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: http://review.coreboot.org/11851
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
1 file changed