libvtreefs: resolve Coverity warnings

This commit is contained in:
David van Moolenbroek 2012-07-30 14:00:22 +00:00
parent 90e2b939ab
commit 5909c8ba20
3 changed files with 5 additions and 5 deletions

View file

@ -211,7 +211,7 @@ struct inode *add_inode(struct inode *parent, char *name,
newnode->i_stat = *stat;
newnode->i_indexed = nr_indexed_entries;
newnode->i_cbdata = cbdata;
strcpy(newnode->i_name, name);
strlcpy(newnode->i_name, name, sizeof(newnode->i_name));
/* Add the inode to the list of children inodes of the parent. */
TAILQ_INSERT_HEAD(&parent->i_children, newnode, i_siblings);

View file

@ -114,7 +114,7 @@ static int go_down(struct inode *parent, char *name, struct inode **child)
/*===========================================================================*
* resolve_link *
*===========================================================================*/
static int resolve_link(struct inode *node, char *pptr, char *tail)
static int resolve_link(struct inode *node, char pptr[PATH_MAX], char *tail)
{
/* Given a symbolic link, resolve and return the contents of the link.
*/
@ -135,9 +135,9 @@ static int resolve_link(struct inode *node, char *pptr, char *tail)
if (len + strlen(tail) >= sizeof(path))
return ENAMETOOLONG;
strcat(path, tail);
strlcat(path, tail, sizeof(path));
strcpy(pptr, path);
strlcpy(pptr, path, PATH_MAX);
return OK;
}

View file

@ -45,7 +45,7 @@ int fs_read(void)
r = vtreefs_hooks->read_hook(node, pos, &ptr, &len,
get_inode_cbdata(node));
assert(len >= 0 && len <= fs_m_in.REQ_NBYTES);
assert(len <= fs_m_in.REQ_NBYTES);
/* Copy the resulting data to user space. */
if (r == OK && len > 0) {