]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common/config: cast OPT_U32 options using uint32_t
authorKefu Chai <tchaikov@gmail.com>
Sat, 30 Apr 2016 10:31:37 +0000 (18:31 +0800)
committerLoic Dachary <ldachary@redhat.com>
Thu, 25 Aug 2016 07:09:47 +0000 (09:09 +0200)
commitf7cd28460147530cfd265a593b32d02adb93abe6
tree262bba1214029d48bf1a7e21fe8e5991badbeb3b
parent518883d939f34ec0afa03aea1bac35960fb579f2
common/config: cast OPT_U32 options using uint32_t

the OPT_U32 options was translated using strict_si_cast<int>(), and then
cast the converted result to uint32_t. this could cause integer
underflow. we could have lifted the burden of checking invalid input
from the user of this option to the strict_si_cast<>() function. so in
this change, we use strict_si_cast<uint32_t>() instead, before casting
the converted value into `uint32_t`.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
(cherry picked from commit b7babd6aa671d688eef0af61ca17fd11eec22773)
src/common/config.cc
src/common/strtol.cc