Comments
Patch
@@ -88,7 +88,7 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
}
- if (dict) {
+ if ((op_ret >= 0) && dict) {
rsp.dict.dict_len = dict_serialized_length (dict);
if (rsp.dict.dict_len < 0) {
gf_log (this->name, GF_LOG_ERROR,
@@ -98,10 +98,9 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
op_ret = -1;
op_errno = EINVAL;
rsp.dict.dict_len = 0;
+ goto out;
}
- }
- if ((op_ret >= 0) && dict) {
rsp.dict.dict_val = GF_CALLOC (1, rsp.dict.dict_len,
gf_server_mt_rsp_buf_t);
if (!rsp.dict.dict_val) {
@@ -118,6 +117,7 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
op_ret = -1;
op_errno = -ret;
rsp.dict.dict_len = 0;
+ goto out;
}
}
in cases where op_ret was -1 and dict was not NULL, the code was setting a dictionary length but not the serialized dictionary. This would cause crashes in the xdr serialization function Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> --- xlators/protocol/server/src/server3_1-fops.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)