From 261015625063ad4e59e08447e17371895511380a Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 27 Feb 2023 12:11:25 -0500 Subject: [PATCH] Stop assuming spans are null-terminated in WiFi driver impls. (#25318) Fixes https://github.com/project-chip/connectedhomeip/issues/24271 --- src/platform/Linux/NetworkCommissioningWiFiDriver.cpp | 2 +- src/platform/nxp/mw320/NetworkCommissioningWiFiDriver.cpp | 2 +- src/platform/webos/NetworkCommissioningWiFiDriver.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp b/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp index fa7b8322cff5ce..d1d40dbe3e3864 100644 --- a/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp @@ -156,7 +156,7 @@ void LinuxWiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callb VerifyOrExit(NetworkMatch(mStagingNetwork, networkId), networkingStatus = Status::kNetworkIDNotFound); - ChipLogProgress(NetworkProvisioning, "LinuxNetworkCommissioningDelegate: SSID: %s", + ChipLogProgress(NetworkProvisioning, "LinuxWiFiDriver: SSID: %.*s", static_cast(networkId.size()), StringOrNullMarker((char *) networkId.data())); err = ConnectivityMgrImpl().ConnectWiFiNetworkAsync(ByteSpan(mStagingNetwork.ssid, mStagingNetwork.ssidLen), diff --git a/src/platform/nxp/mw320/NetworkCommissioningWiFiDriver.cpp b/src/platform/nxp/mw320/NetworkCommissioningWiFiDriver.cpp index 10b361c8fbd35d..c096a47dd0e785 100644 --- a/src/platform/nxp/mw320/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/nxp/mw320/NetworkCommissioningWiFiDriver.cpp @@ -160,7 +160,7 @@ void Mw320WiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callb VerifyOrExit(NetworkMatch(mStagingNetwork, networkId), networkingStatus = Status::kNetworkIDNotFound); - ChipLogProgress(NetworkProvisioning, "LinuxNetworkCommissioningDelegate: SSID: %s", networkId.data()); + ChipLogProgress(NetworkProvisioning, "Mw320WiFiDriver: SSID: %.*s", static_cast(networkId.size()), networkId.data()); err = ConnectivityMgrImpl().ConnectWiFiNetworkAsync(ByteSpan(mStagingNetwork.ssid, mStagingNetwork.ssidLen), ByteSpan(mStagingNetwork.credentials, mStagingNetwork.credentialsLen), diff --git a/src/platform/webos/NetworkCommissioningWiFiDriver.cpp b/src/platform/webos/NetworkCommissioningWiFiDriver.cpp index aa3d7159b3267f..deee11b66e494d 100644 --- a/src/platform/webos/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/webos/NetworkCommissioningWiFiDriver.cpp @@ -156,7 +156,7 @@ void LinuxWiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callb VerifyOrExit(NetworkMatch(mStagingNetwork, networkId), networkingStatus = Status::kNetworkIDNotFound); - ChipLogProgress(NetworkProvisioning, "LinuxNetworkCommissioningDelegate: SSID: %s", networkId.data()); + ChipLogProgress(NetworkProvisioning, "LinuxWiFiDriver: SSID: %.*s", static_cast(networkId.size()), networkId.data()); err = ConnectivityMgrImpl().ConnectWiFiNetworkAsync(ByteSpan(mStagingNetwork.ssid, mStagingNetwork.ssidLen), ByteSpan(mStagingNetwork.credentials, mStagingNetwork.credentialsLen),