Merge pull request #29146 from badone/wip-tracker-40835-OSDCap.PoolClassRNS-abort

osd/OSDCap: Check for empty namespace

Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2019-08-23 13:16:22 +08:00 committed by GitHub
commit 4deb2b90b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,7 +115,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;
}