FruUtils: Avoid truncation in derivation of fruAreaSize
FRU areas can be up to 255 * 8 bytes in length. 2040 can't be
represented in an unsigned 8-bit type, so widen the result type to
match fruBlockSize.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ie331abc2a50d1d91fced2f03d2ba3275331bdeaa
diff --git a/src/FruUtils.cpp b/src/FruUtils.cpp
index 561b007..b8b1905 100644
--- a/src/FruUtils.cpp
+++ b/src/FruUtils.cpp
@@ -304,7 +304,7 @@
return resCodes::resErr;
}
- uint8_t fruAreaSize = *fruBytesIter * fruBlockSize;
+ size_t fruAreaSize = *fruBytesIter * fruBlockSize;
std::vector<uint8_t>::const_iterator fruBytesIterEndArea =
fruBytes.begin() + offset + fruAreaSize - 1;
++fruBytesIter;