Replace all strcat with strlcat

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-03-05 21:48:08 +08:00 committed by Alin Jerpelea
parent 6354a742f1
commit fa8719bb5a
3 changed files with 5 additions and 5 deletions

View File

@ -1554,11 +1554,11 @@ static int add_interface(FAR const char *path,
{ {
/* Convert @path to a directory name. */ /* Convert @path to a directory name. */
strcat(buf, "/"); strlcat(buf, "/", sizeof(buf));
/* Append the real interface name. */ /* Append the real interface name. */
strcat(buf, name); strlcat(buf, name, sizeof(buf));
} }
/* Register the interface in the usual way. NuttX will build the /* Register the interface in the usual way. NuttX will build the

View File

@ -1002,7 +1002,7 @@ static int hostfs_rewinddir(FAR struct inode *mountpt,
static int hostfs_bind(FAR struct inode *blkdriver, FAR const void *data, static int hostfs_bind(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle) FAR void **handle)
{ {
FAR struct hostfs_mountpt_s *fs; FAR struct hostfs_mountpt_s *fs;
FAR char *options; FAR char *options;
char *saveptr; char *saveptr;
char *ptr; char *ptr;
@ -1080,7 +1080,7 @@ static int hostfs_bind(FAR struct inode *blkdriver, FAR const void *data,
if (fs->fs_root[len - 1] != '/') if (fs->fs_root[len - 1] != '/')
{ {
strcat(fs->fs_root, "/"); strlcat(fs->fs_root, "/", sizeof(fs->fs_root));
} }
*handle = (FAR void *)fs; *handle = (FAR void *)fs;

View File

@ -1140,7 +1140,7 @@ static int rpmsgfs_bind(FAR struct inode *blkdriver, FAR const void *data,
if (fs->fs_root[len - 1] != '/') if (fs->fs_root[len - 1] != '/')
{ {
strcat(fs->fs_root, "/"); strlcat(fs->fs_root, "/", sizeof(fs->fs_root));
} }
*handle = (FAR void *)fs; *handle = (FAR void *)fs;