summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-04-14 04:31:22 +0000
committerAnand Avati <avati@gluster.com>2011-04-14 04:07:44 -0700
commit4d6e05f0aac70fbdec6b9530ed7b5d6ce4de0f03 (patch)
tree4118b174853be6e1c65acdf12c2bc648a9c11006 /xlators/mgmt
parentd6cbfe3b4be0af43a14df76e2305488158cff3e1 (diff)
mgmt/glusterd: Prevent dict unserialize for buf with 0 length
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2753 (perf-test failed with "buf is null!" message) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2753
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 247c655b0..95da3d008 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -3157,13 +3157,15 @@ glusterd_handle_cli_profile_volume (rpcsvc_request_t *req)
goto out;
}
- tmp_dict = dict_new();
- if (!tmp_dict)
- goto out;
- dict_unserialize (cli_req.dict_req.dict_req_val,
- cli_req.dict_req.dict_req_len, &tmp_dict);
+ if (cli_req.dict_req.dict_req_len > 0) {
+ tmp_dict = dict_new();
+ if (!tmp_dict)
+ goto out;
+ dict_unserialize (cli_req.dict_req.dict_req_val,
+ cli_req.dict_req.dict_req_len, &tmp_dict);
- dict_copy (tmp_dict, dict);
+ dict_copy (tmp_dict, dict);
+ }
gf_cmd_log ("Volume stats", "volume : %s, op: %d", cli_req.volname,
cli_req.op);