From 97a97c3c554f689dd3f987e63eaa2b9c5ec1dd0a Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 26 Aug 2013 19:46:43 -0700 Subject: [PATCH] rgw: check object name after rebuilding it in S3 POST Fixes: #6088 Backport: bobtail, cuttlefish, dumpling When posting an object it is possible to provide a key name that refers to the original filename, however we need to verify that in the end we don't end up with an empty object name. Reviewed-by: Josh Durgin Signed-off-by: Yehuda Sadeh (cherry picked from commit c8ec532fadc0df36e4b265fe20a2ff3e35319744) --- src/rgw/rgw_rest_s3.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index a88d2a36da735..cb10f34fb2b3c 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -797,6 +797,11 @@ int RGWPostObj_ObjStore_S3::get_params() rebuild_key(s->object_str); + if (s->object_str.empty()) { + err_msg = "Empty object name"; + return -EINVAL; + } + env.add_var("key", s->object_str); part_str("Content-Type", &content_type); -- 2.39.5