]> Zhao Yanbai Git Server - minix.git/commitdiff
libsffs: resolve Coverity warnings
authorDavid van Moolenbroek <david@minix3.org>
Fri, 27 Jul 2012 16:30:58 +0000 (16:30 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Mon, 30 Jul 2012 12:10:14 +0000 (12:10 +0000)
lib/libsffs/dentry.c
lib/libsffs/path.c

index 076226ecc782803d1fa3ee04c96395b3edf020af..53f09731210f47d946ce28c1fdcdd0d9433ac816 100644 (file)
@@ -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);
index 272ca4245a32a3e76705714f28c45033e027da1a..8abe9b3550137eceda22bc0e62c7c8ad511a97c9 100644 (file)
@@ -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;
 }