From ef5fd6c5951eb17630d3ea0554d214f1d3706226 Mon Sep 17 00:00:00 2001 From: Anton Ottosson Date: Tue, 3 Aug 2021 17:35:32 +0200 Subject: [PATCH] Fix `format_mac_address` function in parse_mac.cc Apparently the stream manipulator `std::setw` applies only to the next string written to the stream. Hence the function `format_mac_address` in parse_mac.cc only formatted the first pair of hexadecimal digits correctly. This went unnoticed until now because it only makes a difference for numbers below 0x10. --- lib/parse_mac.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/parse_mac.cc b/lib/parse_mac.cc index 6fdc8a5..5743188 100644 --- a/lib/parse_mac.cc +++ b/lib/parse_mac.cc @@ -419,7 +419,7 @@ public: str << std::setfill('0') << std::hex << std::setw(2) << (int)addr[0]; for (int i = 1; i < 6; i++) { - str << ":" << (int)addr[i]; + str << ":" << std::setw(2) << (int)addr[i]; } return str.str();