summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src/libglusterfsclient.c
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-09-15 08:03:59 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-15 07:19:45 -0700
commit2cd45bcd9f252616c735284516c1f3ac07de00d9 (patch)
treefba4ba38a4283bed346e0d55e96ba3bf796ad268 /libglusterfsclient/src/libglusterfsclient.c
parentce725f84d7d4d40ace9dd7ce5bcc89bdd77ce41d (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/src/libglusterfsclient.c')
-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 029fe22..8b162e2 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);