summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-06-20 13:34:11 +0200
committerAnand Avati <avati@redhat.com>2012-07-02 15:44:26 -0700
commitc62eeda7718e4c15e19ade68455826ab32438f98 (patch)
tree08cdcfe672a067147f02cb418f5272faacbca79d /libglusterfsclient
parent9945a0030a78c33b46dc3fafd313cb87a91289fa (diff)
libgf_client_chdir: don't access path[-1] upon chdir("")
Admittedly, this code may not be reachable via glusterfs_chdir, assuming libgf_client_path_lookup with such a loc.path would fail. Change-Id: I0b72ade0918da30d49bff756dcf04d1512d0177f BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3601 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index 3143a13ed4f..3881ad64296 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -7806,7 +7806,7 @@ libgf_client_chdir (const char *path)
{
if (!libgf_path_absolute (path)) {
resulting_cwd_len = strlen (path) + strlen (cwd)
- + ((path[strlen (path) - 1] == '/')
+ + ((strlen (path) && path[strlen (path) - 1] == '/')
? 0 : 1) + 1;
if (resulting_cwd_len > PATH_MAX) {