]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
bluestore/bluestore_types: avoid heap-buffer-overflow in another way to keep code... 56937/head
authorRongqi Sun <sunrongqi@huawei.com>
Wed, 17 Apr 2024 03:03:43 +0000 (03:03 +0000)
committerRongqi Sun <sunrongqi@huawei.com>
Wed, 17 Apr 2024 03:03:43 +0000 (03:03 +0000)
Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
src/os/bluestore/bluestore_types.h

index 7032ae904e930af68aaa5fb7c641d1ac4992212e..c581036734d0200ac302b87ca486cc2ece56c95d 100644 (file)
@@ -1377,12 +1377,12 @@ struct sb_info_space_efficient_map_t {
       if (aux_items.size() != 0) {
        auto it = std::lower_bound(
          aux_items.begin(),
-         aux_items.end(),
+         aux_items.end() - 1,
          id,
          [](const sb_info_t& a, const uint64_t& b) {
            return a < b;
          });
-        if (it != aux_items.end() && it->get_sbid() == id) {
+        if (it->get_sbid() == id) {
          return it;
        }
       }