Fix format specifier issue with MACAddress
-Use "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx".Here hh is to
tell snprintf that the argument is an unsigned char, 0 is to get
zero padding and 2 to set the width to 2. x or X for
lower/uppercase hex characters.
Fixes openbmc/openbmc#2701
Change-Id: I92a62541157683f8c1e7048160b3d3de772e6125
Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
diff --git a/util.hpp b/util.hpp
index 73649f0..ab7ea51 100644
--- a/util.hpp
+++ b/util.hpp
@@ -26,7 +26,7 @@
constexpr auto localAdminMask = 0x020000000000;
constexpr auto broadcastMac = 0xFFFFFFFFFFFF;
-constexpr auto format = "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx";
+constexpr auto format = "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx";
constexpr size_t size = 18;
/** @brief validate the mac address