Merge pull request #52328 from vedanshbhartia/coverity_1512267

rgw: fix potential null dereference in rgw_iam_policy.c: ParseState::do_string

reviewed-by: yuvalif
This commit is contained in:
Yuval Lifshitz 2023-10-09 17:57:47 +03:00 committed by GitHub
commit 94d69a11ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -532,6 +532,8 @@ boost::optional<Principal> 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)) {