From b87e64e3206210580f4a6df2d77f9ae3f1033039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20H=C3=BCttner?= Date: Thu, 6 May 2021 12:18:00 -0400 Subject: [PATCH] rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name checking for empty name avoids later assertion in RGWObjectCtx::set_atomic Fixes: CVE-2021-3531 Reviewed-by: Casey Bodley Signed-off-by: Casey Bodley (cherry picked from commit 7196a469b4470f3c8628489df9a41ec8b00a5610) --- src/rgw/rgw_rest_swift.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index fb392828a42ac..c358a42f8ee03 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -2549,6 +2549,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));