From 1030904dbd03ab9ccca9b52c34265dfd32e77ca4 Mon Sep 17 00:00:00 2001 From: adabreuti <76965454+adabreuti@users.noreply.github.com> Date: Wed, 30 Mar 2022 21:13:16 -0500 Subject: [PATCH] Resolve default countryCodeSize when not set on commissioner (#16724) * Resolve default countryCodeSize when not set on commissioner * Re-initialize countrycodestr on failure * Generalize print * Update src/controller/CHIPDeviceController.cpp Co-authored-by: Boris Zbarsky Co-authored-by: Boris Zbarsky --- src/controller/CHIPDeviceController.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index d208a99d00bbad..c4f949b13d78e9 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -1723,7 +1723,9 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio #endif if (status != CHIP_NO_ERROR) { - ChipLogError(Controller, "Unable to find country code, defaulting to XX"); + actualCountryCodeSize = 2; + memset(countryCodeStr, 'X', actualCountryCodeSize); + ChipLogError(Controller, "Unable to find country code, defaulting to %s", countryCodeStr); } chip::CharSpan countryCode(countryCodeStr, actualCountryCodeSize);