summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNagaraju Goruganti <ngorugan@in.ibm.com>2017-12-05 00:06:07 -0600
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-12-09 04:56:02 +0000
commit599376355e30c47b040248c9201a537de7e8ce4b (patch)
treefa5e64345a5be046efc004ab30bf0f7bee807af1
parente44acded8fa346f4e807de395e7f148ba095e25a (diff)
downloadphosphor-networkd-599376355e30c47b040248c9201a537de7e8ce4b.tar.gz
phosphor-networkd-599376355e30c47b040248c9201a537de7e8ce4b.zip
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>
-rw-r--r--util.hpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/util.hpp b/util.hpp
index 73649f0..ab7ea51 100644
--- a/util.hpp
+++ b/util.hpp
@@ -26,7 +26,7 @@ constexpr auto regex = "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$";
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
OpenPOWER on IntegriCloud