From: Brad Hubbard Date: Mon, 22 Jul 2019 00:05:09 +0000 (+1000) Subject: osd/OSDCap: Check for empty namespace X-Git-Tag: v13.2.7~160^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F30214%2Fhead;p=ceph.git osd/OSDCap: Check for empty namespace Fixes: http://tracker.ceph.com/issues/40835 Signed-off-by: Brad Hubbard (cherry picked from commit 002ced8a5f25cfbecf5f34e147a0c863ecbf77c7) --- diff --git a/src/osd/OSDCap.cc b/src/osd/OSDCap.cc index 368b59ffdda8..86ddab8080e3 100644 --- a/src/osd/OSDCap.cc +++ b/src/osd/OSDCap.cc @@ -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; }