Skip to content

Commit

Permalink
rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
felixhuettner authored and cbodley committed May 11, 2021
1 parent 36274af commit f44a8ae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rgw/rgw_rest_swift.cc
Expand Up @@ -2545,6 +2545,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));
Expand Down

0 comments on commit f44a8ae

Please sign in to comment.