Skip to content

Commit

Permalink
ovl: check snprintf return
Browse files Browse the repository at this point in the history
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Miklos Szeredi committed Jul 27, 2017
1 parent 520eccd commit 6787341
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/overlayfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,9 @@ static int ovl_set_nlink_common(struct dentry *dentry,
len = snprintf(buf, sizeof(buf), format,
(int) (inode->i_nlink - realinode->i_nlink));

if (WARN_ON(len >= sizeof(buf)))
return -EIO;

return ovl_do_setxattr(ovl_dentry_upper(dentry),
OVL_XATTR_NLINK, buf, len, 0);
}
Expand Down

0 comments on commit 6787341

Please sign in to comment.