[trel] avoid compiler warning on use of strncpy (#6630)

This commit is contained in:
Jonathan Hui
2021-05-14 14:16:39 -07:00
committed by GitHub
parent fa997aead6
commit b9fd3771b0
+2 -2
View File
@@ -629,11 +629,11 @@ void platformTrelInit(const char *aTrelUrl)
{
ot::Posix::RadioUrl url(aTrelUrl);
strncpy(sInterfaceName, url.GetPath(), sizeof(sInterfaceName));
strncpy(sInterfaceName, url.GetPath(), sizeof(sInterfaceName) - 1);
}
else
{
strncpy(sInterfaceName, OPENTHREAD_CONFIG_POSIX_APP_TREL_INTERFACE_NAME, sizeof(sInterfaceName));
strncpy(sInterfaceName, OPENTHREAD_CONFIG_POSIX_APP_TREL_INTERFACE_NAME, sizeof(sInterfaceName) - 1);
}
sInterfaceName[sizeof(sInterfaceName) - 1] = 0;