From: Günther Deschner Date: Mon, 3 Jun 2019 14:28:36 +0000 (+0200) Subject: s3/vfs_glusterfs_fuse: Avoid using NAME_MAX directly X-Git-Tag: ldb-2.0.5~416 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7cc9e3fe24dd476360837c04538345752048e6be;p=thirdparty%2Fsamba.git s3/vfs_glusterfs_fuse: Avoid using NAME_MAX directly BUG: https://bugzilla.samba.org/show_bug.cgi?id=13872 Guenther Signed-off-by: Guenther Deschner Reviewed-by: Volker Lendecke Autobuild-User(master): Günther Deschner Autobuild-Date(master): Tue Jun 11 00:29:19 UTC 2019 on sn-devel-184 --- diff --git a/source3/modules/vfs_glusterfs_fuse.c b/source3/modules/vfs_glusterfs_fuse.c index 8855cd18d01..d92f5e2b08b 100644 --- a/source3/modules/vfs_glusterfs_fuse.c +++ b/source3/modules/vfs_glusterfs_fuse.c @@ -21,6 +21,8 @@ #include "smbd/smbd.h" #include "system/filesys.h" +#define GLUSTER_NAME_MAX 255 + static int vfs_gluster_fuse_get_real_filename(struct vfs_handle_struct *handle, const char *path, const char *name, @@ -28,19 +30,19 @@ static int vfs_gluster_fuse_get_real_filename(struct vfs_handle_struct *handle, char **_found_name) { int ret; - char key_buf[NAME_MAX + 64]; - char val_buf[NAME_MAX + 1]; + char key_buf[GLUSTER_NAME_MAX + 64]; + char val_buf[GLUSTER_NAME_MAX + 1]; char *found_name = NULL; - if (strlen(name) >= NAME_MAX) { + if (strlen(name) >= GLUSTER_NAME_MAX) { errno = ENAMETOOLONG; return -1; } - snprintf(key_buf, NAME_MAX + 64, + snprintf(key_buf, GLUSTER_NAME_MAX + 64, "glusterfs.get_real_filename:%s", name); - ret = getxattr(path, key_buf, val_buf, NAME_MAX + 1); + ret = getxattr(path, key_buf, val_buf, GLUSTER_NAME_MAX + 1); if (ret == -1) { if (errno == ENOATTR) { errno = EOPNOTSUPP;