From 4d6e05f0aac70fbdec6b9530ed7b5d6ce4de0f03 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Thu, 14 Apr 2011 04:31:22 +0000 Subject: mgmt/glusterd: Prevent dict unserialize for buf with 0 length Signed-off-by: Pranith Kumar K Signed-off-by: Anand Avati BUG: 2753 (perf-test failed with "buf is null!" message) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2753 --- xlators/mgmt/glusterd/src/glusterd-handler.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'xlators/mgmt') 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); -- cgit