Skip to content

Commit

Permalink
remplace memcpy by copystring
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartinez-silabs committed May 18, 2023
1 parent f9d2788 commit 91c55d8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/platform/silabs/SilabsDeviceDataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ CHIP_ERROR SilabsDeviceDataProvider::GetVendorName(char * buf, size_t bufSize)
if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND)
{
VerifyOrReturnError(buf != nullptr, CHIP_ERROR_NO_MEMORY);
memcpy(buf, CHIP_DEVICE_CONFIG_TEST_VENDOR_NAME, bufSize);
VerifyOrReturnError(bufSize > strlen(CHIP_DEVICE_CONFIG_TEST_VENDOR_NAME), CHIP_ERROR_BUFFER_TOO_SMALL);
Platform::CopyString(buf, bufSize, CHIP_DEVICE_CONFIG_TEST_VENDOR_NAME);
err = CHIP_NO_ERROR;
}
#endif
Expand Down Expand Up @@ -353,7 +354,8 @@ CHIP_ERROR SilabsDeviceDataProvider::GetProductName(char * buf, size_t bufSize)
if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND)
{
VerifyOrReturnError(buf != nullptr, CHIP_ERROR_NO_MEMORY);
memcpy(buf, CHIP_DEVICE_CONFIG_TEST_PRODUCT_NAME, bufSize);
VerifyOrReturnError(bufSize > strlen(CHIP_DEVICE_CONFIG_TEST_VENDOR_NAME), CHIP_ERROR_BUFFER_TOO_SMALL);
Platform::CopyString(buf, bufSize, CHIP_DEVICE_CONFIG_TEST_PRODUCT_NAME);
err = CHIP_NO_ERROR;
}
#endif
Expand Down Expand Up @@ -389,7 +391,7 @@ CHIP_ERROR SilabsDeviceDataProvider::GetHardwareVersionString(char * buf, size_t
if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND)
{
VerifyOrReturnError(buf != nullptr, CHIP_ERROR_NO_MEMORY);
memcpy(buf, CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING, bufSize);
Platform::CopyString(buf, bufSize, CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING);
err = CHIP_NO_ERROR;
}
#endif // CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING
Expand Down

0 comments on commit 91c55d8

Please sign in to comment.