[Gluster-devel] [PATCH] fix possible array out of bound
Ruoyu
liangry at ucweb.com
Tue Aug 12 03:22:00 UTC 2014
fix dangerous usage of volname because strncpy does not always
null-terminated.
Signed-off-by: Ruoyu <liangry at ucweb.com>
---
xlators/nfs/server/src/nfs-common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c
index f74396e..1462c1b 100644
--- a/xlators/nfs/server/src/nfs-common.c
+++ b/xlators/nfs/server/src/nfs-common.c
@@ -85,7 +85,7 @@ nfs_mntpath_to_xlator (xlator_list_t *cl, char *path)
if ((!cl) || (!path))
return NULL;
- strncpy (volname, path, MNTPATHLEN);
+ snprintf (volname, sizeof(volname), "%s", path);
pathlen = strlen (volname);
gf_log (GF_NFS, GF_LOG_TRACE, "Subvolume search: %s", path);
if (volname[0] == '/')
--
1.8.3.2
More information about the Gluster-devel
mailing list