summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorVijaikumar M <vmallika@redhat.com>2014-03-13 16:39:27 +0530
committerRajesh Joseph <rjoseph@redhat.com>2014-03-13 04:30:41 -0700
commit4f6c888c5cc32381273d563b184bcb032ee38cc9 (patch)
tree028beb946ae8b29730afa9e89756e5fd9492c5a0 /xlators/mgmt
parent2aa6db3491d58fb7e28da07fbe4d461a0a646d9b (diff)
glusterd/snapshot: Validate snapshot name length while creation
Change-Id: Iaee04f5209e278d83c086e32c4cafd6c571370cd Signed-off-by: Vijaikumar M <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/7242 Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 900b528..c9c23bf 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -2234,6 +2234,13 @@ glusterd_handle_snapshot_create (rpcsvc_request_t *req, glusterd_op_t op,
goto out;
}
+ if (strlen(snapname) >= GLUSTERD_MAX_SNAP_NAME) {
+ snprintf (err_str, len, "Snapshot name too long");
+ gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ ret = -1;
+ goto out;
+ }
+
uuid_ptr = GF_CALLOC (1, sizeof(uuid_t), gf_common_mt_uuid_t);
if (!uuid_ptr) {
gf_log (this->name, GF_LOG_ERROR, "Out Of Memory");
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index b70709d..bcc376a 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -40,7 +40,6 @@
#include "store.h"
#define GLUSTERD_MAX_VOLUME_NAME 1000
-#define GLUSTERD_MAX_SNAP_NAME 128
#define GLUSTERD_TR_LOG_SIZE 50
#define GLUSTERD_NAME "glusterd"
#define GLUSTERD_SOCKET_LISTEN_BACKLOG 128