diff options
author | Jim Meyering <meyering@redhat.com> | 2012-06-20 10:01:08 +0200 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-07-11 19:13:09 -0700 |
commit | fa946a8448dd3916c3fb31c9ba6cf195f98fc58c (patch) | |
tree | 4e631c74fec9d2ff91f6ad2b5c2e44f39a87e557 /xlators/nfs | |
parent | 3c28358a6ff00cb05bfccd8be15f4d204aaccefd (diff) |
nfs-common: don't let 0-length path cause buf[-1] access
Change-Id: I5f0e93448a954aff1ff08a0980fb9bfd60e63988
BUG: 789278
Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-on: http://review.gluster.com/3594
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/nfs')
-rw-r--r-- | xlators/nfs/server/src/nfs-common.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c index ec76c294f01..21093d71197 100644 --- a/xlators/nfs/server/src/nfs-common.c +++ b/xlators/nfs/server/src/nfs-common.c @@ -88,7 +88,7 @@ nfs_mntpath_to_xlator (xlator_list_t *cl, char *path) { char volname[MNTPATHLEN]; char *volptr = NULL; - int pathlen = 0; + size_t pathlen; xlator_t *targetxl = NULL; if ((!cl) || (!path)) @@ -102,7 +102,7 @@ nfs_mntpath_to_xlator (xlator_list_t *cl, char *path) else volptr = &volname[0]; - if (volname[pathlen - 1] == '/') + if (pathlen && volname[pathlen - 1] == '/') volname[pathlen - 1] = '\0'; while (cl) { |