diff options
author | Nagaraju Goruganti <ngorugan@in.ibm.com> | 2017-12-05 00:06:07 -0600 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-12-09 04:56:02 +0000 |
commit | 599376355e30c47b040248c9201a537de7e8ce4b (patch) | |
tree | fa5e64345a5be046efc004ab30bf0f7bee807af1 | |
parent | e44acded8fa346f4e807de395e7f148ba095e25a (diff) | |
download | phosphor-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.hpp | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 |