diff options
author | Raghavendra G <raghavendra@gluster.com> | 2009-09-15 08:07:30 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-09-15 07:19:35 -0700 |
commit | 3508a2d237cee98eb5c890011b569a1820b57f5c (patch) | |
tree | 22f77a361c9889543852e95743831fae8d272722 /libglusterfsclient | |
parent | 7bc96160b977345bda80c09e212d9d9c80243e7f (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-x | libglusterfsclient/src/libglusterfsclient.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index bba5877897e..8fb1441722a 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); |