diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2012-07-30 22:31:31 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-08-01 00:03:15 -0700 |
commit | 5070aa3973066ba7347b14b4b993dcde11e08165 (patch) | |
tree | fc122a58e878e991decbbc77f3cd773a93832d0b /swift/1.4.8 | |
parent | 9fcc3f4dede2829d457b6e1c76f53c25ba790988 (diff) |
protocol/client: Fix negative return in client_setvolume
PROBLEM:
The function dict_serialized_length could, owing to an error,
return a negative integer (-EINVAL) that gets assigned to an
unsigned int member 'dict_len' of gf_setvolume_req structure.
FIX:
Hold the value returned by dict_serialized_length in local
variable ret (which is a signed int). Test if ret is negative,
in which case the control would anyway branch to the label fail
where the function returns. Otherwise dict_len is assigned with
ret, in turn giving a more meaningful value to the attribute
length.
TEST:
Attached gdb to glusterfs mount process, set breakpoint at
client_setvolume, forced dict_serialized_length to return
-EINVAL (indirectly by forcing _dict_serialized_length to return
-EINVAL after setting count to -1 within its body) and checked
the value of ret (which is now sure to contain a negative value)
whose value will be appropriately tested to decide the next
course of action within client_setvolume: whether to simply
exit due to an error or execute the subsequent statements.
Change-Id: Ib22ad8f30d8ae04acaf2ff5bfee9c348a2c47148
BUG: 789278
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.com/3755
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'swift/1.4.8')
0 files changed, 0 insertions, 0 deletions