From fa8719bb5a0e1ce37c1d1398faf5be02362a45c1 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sun, 5 Mar 2023 21:48:08 +0800 Subject: [PATCH] Replace all strcat with strlcat Signed-off-by: Xiang Xiao --- drivers/video/max7456.c | 4 ++-- fs/hostfs/hostfs.c | 4 ++-- fs/rpmsgfs/rpmsgfs.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/video/max7456.c b/drivers/video/max7456.c index 518d5583510..66ba212700f 100644 --- a/drivers/video/max7456.c +++ b/drivers/video/max7456.c @@ -1554,11 +1554,11 @@ static int add_interface(FAR const char *path, { /* Convert @path to a directory name. */ - strcat(buf, "/"); + strlcat(buf, "/", sizeof(buf)); /* Append the real interface name. */ - strcat(buf, name); + strlcat(buf, name, sizeof(buf)); } /* Register the interface in the usual way. NuttX will build the diff --git a/fs/hostfs/hostfs.c b/fs/hostfs/hostfs.c index 8ee8aed21f8..f250f3d9892 100644 --- a/fs/hostfs/hostfs.c +++ b/fs/hostfs/hostfs.c @@ -1002,7 +1002,7 @@ static int hostfs_rewinddir(FAR struct inode *mountpt, static int hostfs_bind(FAR struct inode *blkdriver, FAR const void *data, FAR void **handle) { - FAR struct hostfs_mountpt_s *fs; + FAR struct hostfs_mountpt_s *fs; FAR char *options; char *saveptr; char *ptr; @@ -1080,7 +1080,7 @@ static int hostfs_bind(FAR struct inode *blkdriver, FAR const void *data, if (fs->fs_root[len - 1] != '/') { - strcat(fs->fs_root, "/"); + strlcat(fs->fs_root, "/", sizeof(fs->fs_root)); } *handle = (FAR void *)fs; diff --git a/fs/rpmsgfs/rpmsgfs.c b/fs/rpmsgfs/rpmsgfs.c index 71f1349f1ce..c8b8d048b28 100644 --- a/fs/rpmsgfs/rpmsgfs.c +++ b/fs/rpmsgfs/rpmsgfs.c @@ -1140,7 +1140,7 @@ static int rpmsgfs_bind(FAR struct inode *blkdriver, FAR const void *data, if (fs->fs_root[len - 1] != '/') { - strcat(fs->fs_root, "/"); + strlcat(fs->fs_root, "/", sizeof(fs->fs_root)); } *handle = (FAR void *)fs;