Replace usage of forbidden strncpy with strscpy
strscpy copies max destination size -1 chars and ensures NULL
termination. It also return an error if the destination buffer is too
small.
Change-Id: I88e9e5020b2b26ca50c12ae845dad070855a8bde
diff --git a/kernel/ethosu_network_info.c b/kernel/ethosu_network_info.c
index c2b6caa..ebb059c 100644
--- a/kernel/ethosu_network_info.c
+++ b/kernel/ethosu_network_info.c
@@ -192,7 +192,11 @@
goto signal_complete;
}
- strncpy(info->uapi->desc, rsp->desc, sizeof(info->uapi->desc));
+ ret = strscpy(info->uapi->desc, rsp->desc, sizeof(info->uapi->desc));
+ if (ret < 0) {
+ info->errno = ret;
+ goto signal_complete;
+ }
info->uapi->ifm_count = rsp->ifm_count;
for (i = 0; i < rsp->ifm_count; i++)