]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
bluestore/bluestore_types: avoid heap-buffer-overflow in another way to keep code... 58818/head
authorRongqi Sun <sunrongqi@huawei.com>
Wed, 17 Apr 2024 03:03:43 +0000 (03:03 +0000)
committerRongqi Sun <sunrongqi@huawei.com>
Thu, 25 Jul 2024 05:46:03 +0000 (13:46 +0800)
Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
(cherry picked from commit 8564caf393a8fe6ef1bb1741a399ab264397648c)

src/os/bluestore/bluestore_types.h

index dd1773c6ad292cdedfa4e5c2532b9ed0831ee7da..6438ba07d00e941dc7ae7618bad4275a0688a5e2 100644 (file)
@@ -1310,12 +1310,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;
        }
       }