From ee71bbbcb53b1838527e8f3efc2cfb3ff641abf2 Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Fri, 27 Jul 2012 16:30:58 +0000 Subject: [PATCH] libsffs: resolve Coverity warnings --- lib/libsffs/dentry.c | 2 +- lib/libsffs/path.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libsffs/dentry.c b/lib/libsffs/dentry.c index 076226ecc..53f097312 100644 --- a/lib/libsffs/dentry.c +++ b/lib/libsffs/dentry.c @@ -82,7 +82,7 @@ struct inode *ino; link_inode(parent, ino); - strcpy(ino->i_name, name); + strlcpy(ino->i_name, name, sizeof(ino->i_name)); /* hash_add(ino); */ slot = hash_dentry(parent, ino->i_name); diff --git a/lib/libsffs/path.c b/lib/libsffs/path.c index 272ca4245..8abe9b355 100644 --- a/lib/libsffs/path.c +++ b/lib/libsffs/path.c @@ -58,8 +58,8 @@ struct inode *ino; */ if (!prefix[0] && p[0] == '/') p++; - strcpy(path, prefix); - strcpy(&path[plen], p); + strlcpy(path, prefix, PATH_MAX); + strlcpy(&path[plen], p, PATH_MAX - plen); dprintf(("%s: make_path: resulting path is '%s'\n", sffs_name, path)); @@ -85,7 +85,7 @@ char *name; return ENAMETOOLONG; if (len > 0) path[len++] = '/'; - strcpy(&path[len], name); + strlcpy(&path[len], name, PATH_MAX - len); return OK; } -- 2.44.0