]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ovl: check snprintf return
authorMiklos Szeredi <mszeredi@redhat.com>
Thu, 27 Jul 2017 19:54:05 +0000 (21:54 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 27 Jul 2017 19:54:05 +0000 (21:54 +0200)
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/inode.c

index 5bc71642b22605367ee319abdf8e45a0ec9adcde..aecaadc8f9e739a88d2d7ab978e99a7e2065efc6 100644 (file)
@@ -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);
 }