From: Vedansh Bhartia Date: Thu, 6 Jul 2023 05:59:00 +0000 (+0530) Subject: rgw: add assert in ParseState::do_string X-Git-Tag: v19.0.0~312^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=664a24fa68aed4f2943eeedadb85cef7b92163c4;p=ceph.git rgw: add assert in ParseState::do_string Signed-off-by: Vedansh Bhartia --- diff --git a/src/rgw/rgw_iam_policy.cc b/src/rgw/rgw_iam_policy.cc index 35aeb15fcdc5..0452fde25f1e 100644 --- a/src/rgw/rgw_iam_policy.cc +++ b/src/rgw/rgw_iam_policy.cc @@ -532,6 +532,8 @@ boost::optional ParseState::parse_principal(string&& s, } bool ParseState::do_string(CephContext* cct, const char* s, size_t l) { + assert(s); + auto k = pp->tokens.lookup(s, l); Policy& p = pp->policy; bool is_action = false; @@ -565,9 +567,9 @@ bool ParseState::do_string(CephContext* cct, const char* s, size_t l) { std::string_view{s, l})); return false; } - } else if (w->id == TokenID::Principal && s && *s == '*') { + } else if (w->id == TokenID::Principal && *s == '*') { t->princ.emplace(Principal::wildcard()); - } else if (w->id == TokenID::NotPrincipal && s && *s == '*') { + } else if (w->id == TokenID::NotPrincipal && *s == '*') { t->noprinc.emplace(Principal::wildcard()); } else if ((w->id == TokenID::Action) || (w->id == TokenID::NotAction)) {