]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add assert in ParseState::do_string 52328/head
authorVedansh Bhartia <vedanshbhartia@gmail.com>
Thu, 6 Jul 2023 05:59:00 +0000 (11:29 +0530)
committerVedansh Bhartia <vedanshbhartia@gmail.com>
Mon, 24 Jul 2023 18:07:33 +0000 (23:37 +0530)
Signed-off-by: Vedansh Bhartia <vedanshbhartia@gmail.com>
src/rgw/rgw_iam_policy.cc

index 35aeb15fcdc5aacc7b0e9180c4b774a171788339..0452fde25f1e9d87b6a7d590e3a1dc59035573b9 100644 (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)) {