From: David van Moolenbroek Date: Fri, 27 Jul 2012 16:30:58 +0000 (+0000) Subject: libsffs: resolve Coverity warnings X-Git-Tag: v3.2.1~421 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=ee71bbbcb53b1838527e8f3efc2cfb3ff641abf2;p=minix.git libsffs: resolve Coverity warnings --- 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; }