rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name
authorFelix Hüttner <felix.huettner@mail.schwarz>
Thu, 6 May 2021 16:18:00 +0000 (12:18 -0400)
committerBastien Roucariès <rouca@debian.org>
Sat, 21 Oct 2023 16:42:26 +0000 (17:42 +0100)
checking for empty name avoids later assertion in RGWObjectCtx::set_atomic

Fixes: CVE-2021-3531
Reviewed-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 7196a469b4470f3c8628489df9a41ec8b00a5610)

Origin: upstream, https://github.com/ceph/ceph/commit/f44a8ae8aa27ecef69528db9aec220f12492810e

Gbp-Pq: Name CVE-2021-3531.patch

src/rgw/rgw_rest_swift.cc

index 35e192c150ed350736a819609118c362bd5ac6dc..98f10e68008e25795edca1e2f745d58f3ca1482c 100644 (file)
@@ -2436,6 +2436,9 @@ bool RGWSwiftWebsiteHandler::is_web_dir() const
     return false;
   } else if (subdir_name.back() == '/') {
     subdir_name.pop_back();
+    if (subdir_name.empty()) {
+      return false;
+    }
   }
 
   rgw_obj obj(s->bucket, std::move(subdir_name));