Use strncpy instead of strcpy in uname()

This commit is contained in:
Gregory Nutt
2015-07-04 15:20:36 -06:00
parent 31476394bc
commit 10ec4737c2
+4 -4
View File
@@ -80,7 +80,7 @@ int uname(FAR struct utsname *name)
{ {
int ret = 1; int ret = 1;
strcpy(name->sysname, "NuttX"); strncpy(name->sysname, "NuttX", SYS_NAMELEN);
#ifdef CONFIG_NET #ifdef CONFIG_NET
/* Get the hostname */ /* Get the hostname */
@@ -94,9 +94,9 @@ int uname(FAR struct utsname *name)
strcpy(name->nodename, ""); strcpy(name->nodename, "");
#endif #endif
strcpy(name->release, CONFIG_VERSION_STRING); strncpy(name->release, CONFIG_VERSION_STRING, SYS_NAMELEN);
strcpy(name->version, CONFIG_VERSION_BUILD); strncpy(name->version, CONFIG_VERSION_BUILD, SYS_NAMELEN);
strcpy(name->machine, CONFIG_ARCH); strncpy(name->machine, CONFIG_ARCH, SYS_NAMELEN);
return ret; return ret;
} }