summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-09-15 08:07:30 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-15 07:19:35 -0700
commit3508a2d237cee98eb5c890011b569a1820b57f5c (patch)
tree22f77a361c9889543852e95743831fae8d272722 /libglusterfsclient
parent7bc96160b977345bda80c09e212d9d9c80243e7f (diff)
libglusterfsclient: NULL terminate the vmp entry during vmp_entry_init.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 263 (files are not resolved to glusterfs when vmp is not terminated with a '/'.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=263
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index bba5877..8fb1441 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -1382,7 +1382,7 @@ libgf_init_vmpentry (char *vmp, glusterfs_handle_t *vmphandle)
appendslash = 1;
}
- entry->vmp = CALLOC (vmplen, sizeof (char));
+ entry->vmp = CALLOC (vmplen + 1, sizeof (char));
if (!entry->vmp) {
gf_log (LIBGF_XL_NAME, GF_LOG_ERROR, "Memory allocation "
"failed");
@@ -1390,8 +1390,11 @@ libgf_init_vmpentry (char *vmp, glusterfs_handle_t *vmphandle)
}
strcpy (entry->vmp, vmp);
- if (appendslash)
+ if (appendslash) {
entry->vmp[vmplen-1] = '/';
+ entry->vmp[vmplen] = '\0';
+ }
+
entry->vmplen = vmplen;
entry->handle = vmphandle;
INIT_LIST_HEAD (&entry->list);