]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDCap: Check for empty namespace 30214/head
authorBrad Hubbard <bhubbard@redhat.com>
Mon, 22 Jul 2019 00:05:09 +0000 (10:05 +1000)
committerNathan Cutler <ncutler@suse.com>
Fri, 6 Sep 2019 15:29:39 +0000 (17:29 +0200)
Fixes: http://tracker.ceph.com/issues/40835
Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
(cherry picked from commit 002ced8a5f25cfbecf5f34e147a0c863ecbf77c7)

src/osd/OSDCap.cc

index 368b59ffdda89b2e96e98d5443c6762c9dd9989e..86ddab8080e35bab4b4963622ac17b3288c81b2e 100644 (file)
@@ -118,7 +118,7 @@ bool OSDCapPoolNamespace::is_match(const std::string& pn,
     }
   }
   if (nspace) {
-    if ((*nspace)[nspace->length() - 1] == '*' &&
+    if (!nspace->empty() && nspace->back() == '*' &&
        boost::starts_with(ns, nspace->substr(0, nspace->length() - 1))) {
       return true;
     }