From 237d32b784cfb0ff93f7f1081d89809af962ed56 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 20 Jun 2012 13:17:49 +0200 Subject: libgf_init_vmpentry: assert strlen(vmp) > 0 to guard against using vmp[-1] Change-Id: I091e6066fd470e9e0b67a00464b5713b86d3783c BUG: 789278 Signed-off-by: Jim Meyering Reviewed-on: http://review.gluster.com/3599 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfsclient/src/libglusterfsclient.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libglusterfsclient/src') 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; -- cgit