Skip to content

Commit 6787341

Browse files
author
Miklos Szeredi
committed
ovl: check snprintf return
Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 520eccd commit 6787341

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/overlayfs/inode.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,9 @@ static int ovl_set_nlink_common(struct dentry *dentry,
498498
len = snprintf(buf, sizeof(buf), format,
499499
(int) (inode->i_nlink - realinode->i_nlink));
500500

501+
if (WARN_ON(len >= sizeof(buf)))
502+
return -EIO;
503+
501504
return ovl_do_setxattr(ovl_dentry_upper(dentry),
502505
OVL_XATTR_NLINK, buf, len, 0);
503506
}

0 commit comments

Comments
 (0)