mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
Use strncpy instead of strcpy in uname()
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user