]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
Check if `HTTP_X_AMZ_COPY_SOURCE` header is empty
authorSuyash Dongre <suyashd999@gmail.com>
Wed, 20 Aug 2025 17:52:41 +0000 (23:22 +0530)
committerMatt Benjamin <mbenjamin@redhat.com>
Wed, 5 Nov 2025 18:08:56 +0000 (13:08 -0500)
The issue was that the `HTTP_X_AMZ_COPY_SOURCE` header could be present but empty (i.e., an empty string rather than NULL). The  code only checked if the pointer was not NULL, but didn't verify that the string had content. When an empty string was passed to RGWCopyObj::parse_copy_location(), it would eventually try to access name_str[0] on an empty string, causing a crash.

Fixes: https://tracker.ceph.com/issues/72669
Resolves: rhbz#2412218

Signed-off-by: Suyash Dongre <suyashd999@gmail.com>
(cherry picked from commit bef59f17293e6e93af025eba1e00646d0b1a2bf0)

src/rgw/rgw_op.cc

index 68b4b0c2b5bd9725a9d2fb27272fc6130796d204..96b19755c907f37383a53f73e22836d4b5044fd6 100644 (file)
@@ -5912,6 +5912,9 @@ bool RGWCopyObj::parse_copy_location(const std::string_view& url_src,
     params_str = url_src.substr(pos + 1);
   }
 
+  if (name_str.empty()) {
+    return false;
+  }
   if (name_str[0] == '/') // trim leading slash
     name_str.remove_prefix(1);