Permalink
Browse files

libgf_count_path_components: don't access pathdup[-1] for empty input

Change-Id: I432f8c8fac907f625d79b2c5bb626a1f7013a73e
BUG: 789278
Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-on: http://review.gluster.com/3600
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
  • Loading branch information...
1 parent 237d32b commit 9945a0030a78c33b46dc3fafd313cb87a91289fa Jim Meyering committed with avati Jun 20, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 libglusterfsclient/src/libglusterfsclient.c
@@ -1505,7 +1505,7 @@ libgf_count_path_components (char *path)
char *pathdup = NULL;
int len = 0;
- if (!path)
+ if (!path || !*path)
return -1;
pathdup = strdup (path);

0 comments on commit 9945a00

Please sign in to comment.