summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-06-20 13:17:49 +0200
committerAnand Avati <avati@redhat.com>2012-07-02 15:43:46 -0700
commit237d32b784cfb0ff93f7f1081d89809af962ed56 (patch)
tree52df6aca00b51a6be63cf97f7db33fbec617e2c1
parentee3ed7c0bfcd340cd747a20812062925d5550d2a (diff)
libgf_init_vmpentry: assert strlen(vmp) > 0 to guard against using vmp[-1]
Change-Id: I091e6066fd470e9e0b67a00464b5713b86d3783c BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3599 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index b0ae61dad31..e09dc39aa3b 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -1443,7 +1443,7 @@ struct vmp_entry *
libgf_init_vmpentry (char *vmp, glusterfs_handle_t *vmphandle)
{
struct vmp_entry *entry = NULL;
- int vmplen = 0;
+ size_t vmplen = 0;
int appendslash = 0;
int ret = -1;
@@ -1454,6 +1454,7 @@ libgf_init_vmpentry (char *vmp, glusterfs_handle_t *vmphandle)
}
vmplen = strlen (vmp);
+ assert (vmplen > 0);
if (vmp[vmplen - 1] != '/') {
vmplen++;
appendslash = 1;