Skip to content

Commit 94d69a1

Browse files
authored
Merge pull request ceph#52328 from vedanshbhartia/coverity_1512267
rgw: fix potential null dereference in rgw_iam_policy.c: ParseState::do_string reviewed-by: yuvalif
2 parents 4bf3b6b + 664a24f commit 94d69a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rgw/rgw_iam_policy.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,8 @@ boost::optional<Principal> ParseState::parse_principal(string&& s,
532532
}
533533

534534
bool ParseState::do_string(CephContext* cct, const char* s, size_t l) {
535+
assert(s);
536+
535537
auto k = pp->tokens.lookup(s, l);
536538
Policy& p = pp->policy;
537539
bool is_action = false;
@@ -565,9 +567,9 @@ bool ParseState::do_string(CephContext* cct, const char* s, size_t l) {
565567
std::string_view{s, l}));
566568
return false;
567569
}
568-
} else if (w->id == TokenID::Principal && s && *s == '*') {
570+
} else if (w->id == TokenID::Principal && *s == '*') {
569571
t->princ.emplace(Principal::wildcard());
570-
} else if (w->id == TokenID::NotPrincipal && s && *s == '*') {
572+
} else if (w->id == TokenID::NotPrincipal && *s == '*') {
571573
t->noprinc.emplace(Principal::wildcard());
572574
} else if ((w->id == TokenID::Action) ||
573575
(w->id == TokenID::NotAction)) {

0 commit comments

Comments
 (0)