summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijaikumar M <vmallika@redhat.com>2014-03-13 13:35:09 +0530
committerRajesh Joseph <rjoseph@redhat.com>2014-03-13 02:55:41 -0700
commit0e94e037ac8d7636288ac89d44f0f255e9e8777b (patch)
treedb4e2df749773dde24bb55621175bdec309fcb5e
parentb458f7b40b19727258fa3268cc8d1147f630fe26 (diff)
glusterd/snapshot: Validate path provided for snapshot mount
Change-Id: Ia534b02051ada58586318b109f40c5ff77148527 BUG: 1075527 Signed-off-by: Vijaikumar M <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/7239 Reviewed-by: Sachin Pandit <spandit@redhat.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Rajesh Joseph <rjoseph@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index 2fe0d0e..98f2a0d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -78,7 +78,20 @@ build_volfile_path (const char *volname, char *path,
/*split string by "/" */
str_token = strtok_r(str_token, "/", &save_ptr);
snapname = strtok_r(NULL, "/", &save_ptr);
+ if (!snapname) {
+ gf_log(THIS->name, GF_LOG_ERROR, "Invalid path: %s",
+ volname);
+ ret = -1;
+ goto out;
+ }
+
snap_volname = strtok_r(NULL, "/", &save_ptr);
+ if (!snap_volname) {
+ gf_log(THIS->name, GF_LOG_ERROR, "Invalid path: %s",
+ volname);
+ ret = -1;
+ goto out;
+ }
snap = glusterd_find_snap_by_name (snapname);
if (!snap) {