frudevice: cast to unsigned, avoid negative values

The FRU device contents are stored in a character vector, and this
includes some numbers.  The values that can be numbers (the offsets),
can be 255 (0xff), and this when promoted to an int becomes -1.  By
casting the value to an unsigned type first, we then get promoted to
255.

Tested: This patchset has not been explicitly tested as I have no test
systems with an offset of 255 in the tables, but the specification for
IPMI FRU permits this value.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I186798840d674b4c1cf5a3905eb606add331ec74
diff --git a/src/FruDevice.cpp b/src/FruDevice.cpp
index 4b6d7c2..48cec11 100644
--- a/src/FruDevice.cpp
+++ b/src/FruDevice.cpp
@@ -118,9 +118,8 @@
     int fruLength = 0;
     for (size_t jj = 1; jj <= FRU_AREAS.size(); jj++)
     {
-        // TODO: offset can be 255, device is holding "chars" that's not
-        // good.
-        int areaOffset = device[jj];
+        // Offset value can be 255.
+        int areaOffset = static_cast<uint8_t>(device[jj]);
         if (areaOffset == 0)
         {
             continue;
@@ -143,7 +142,7 @@
             return {};
         }
 
-        // Ignore data type.
+        // Ignore data type (blockData is already unsigned).
         int length = blockData[1] * 8;
         areaOffset += length;
         fruLength = (areaOffset > fruLength) ? areaOffset : fruLength;
@@ -153,7 +152,7 @@
     {
         // device[area count] is the index to the last area because the 0th
         // entry is not an offset in the common header.
-        int areaOffset = device[FRU_AREAS.size()];
+        int areaOffset = static_cast<uint8_t>(device[FRU_AREAS.size()]);
         areaOffset *= 8;
 
         // the multi-area record header is 5 bytes long.