summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2017-07-27 21:54:05 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2017-07-27 21:54:05 +0200
commit6787341a0f15cc79b9dd4f1341df2f5f3ad3bff1 (patch)
treea7ae1a9c2d583769360065817c840b7f533cac0a /fs
parentLinux 4.13-rc2 (diff)
downloadlinux-6787341a0f15cc79b9dd4f1341df2f5f3ad3bff1.tar.xz
linux-6787341a0f15cc79b9dd4f1341df2f5f3ad3bff1.zip
ovl: check snprintf return
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/overlayfs/inode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 5bc71642b226..aecaadc8f9e7 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -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);
}