diff options
-rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index 385e5b70ee8..35f6cd00564 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -856,6 +856,7 @@ serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp) gfs3_dirplist *trav = NULL; gfs3_dirplist *prev = NULL; int ret = -1; + int temp = 0; GF_VALIDATE_OR_GOTO ("server", entries, out); GF_VALIDATE_OR_GOTO ("server", rsp, out); @@ -875,8 +876,9 @@ serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp) /* if 'dict' is present, pack it */ if (entry->dict) { - trav->dict.dict_len = dict_serialized_length (entry->dict); - if (trav->dict.dict_len > UINT_MAX) { + temp = dict_serialized_length (entry->dict); + + if (temp < 0) { gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, PS_MSG_INVALID_ENTRY, "failed to get " "serialized length of reply dict"); @@ -884,6 +886,7 @@ serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp) trav->dict.dict_len = 0; goto out; } + trav->dict.dict_len = temp; trav->dict.dict_val = GF_CALLOC (1, trav->dict.dict_len, gf_server_mt_rsp_buf_t); |