diff --git a/src/common/shared/strings/include/strings/StringParsing.hxx b/src/common/shared/strings/include/strings/StringParsing.hxx index dd2c03bd..3ab7880a 100644 --- a/src/common/shared/strings/include/strings/StringParsing.hxx +++ b/src/common/shared/strings/include/strings/StringParsing.hxx @@ -34,7 +34,7 @@ ParseHexString(const std::string& hexString, ContainerT& result) } std::string_view hexStringView{ hexString }; - for (std::size_t i = 0; i < std::size(hexString); i++) { + for (std::size_t i = 0; i < std::size(result); i++) { const auto byteAsHex = hexStringView.substr(i * 2, 2); // 2 hex chars const auto byteConversionResult = std::from_chars(std::data(byteAsHex), std::data(byteAsHex) + std::size(byteAsHex), result[i], 16); if (byteConversionResult.ec != std::errc{}) { diff --git a/src/common/tools/cli/NetRemoteCli.cxx b/src/common/tools/cli/NetRemoteCli.cxx index 93d69782..b68bc3d5 100644 --- a/src/common/tools/cli/NetRemoteCli.cxx +++ b/src/common/tools/cli/NetRemoteCli.cxx @@ -118,14 +118,20 @@ NetRemoteCli::AddSubcommandWifiAccessPointsEnumerate(CLI::App* parent) namespace detail { +/** + * @brief Thin wrapper to destructure the std::tuple used to parse SAE passwords. + * + * @param saePasswordArgument The tuple containing the SAE password, password ID, and peer MAC address. + * @return Ieee80211RsnaPassword + */ Ieee80211RsnaPassword -ParseSaePasswordCliArgument(const std::tuple, std::optional>& saePasswordArgument) +ParseSaePasswordCliArgument(std::tuple, std::optional>& saePasswordArgument) { const auto& [password, passwordId, peerMacAddress] = saePasswordArgument; // NOLINT(cppcoreguidelines-pro-bounds-constant-array-index) Ieee80211RsnaPassword saePassword{ - .Credential = password, - .PasswordId = passwordId, + .Credential = std::move(password), + .PasswordId = std::move(passwordId), .PeerMacAddress = peerMacAddress.and_then(Ieee80211MacAddressFromString) };