Skip to content

Commit bef59f1

Browse files
committed
Check if HTTP_X_AMZ_COPY_SOURCE header is empty
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 Signed-off-by: Suyash Dongre <[email protected]>
1 parent 1f34c27 commit bef59f1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/rgw/rgw_op.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5426,6 +5426,9 @@ bool RGWCopyObj::parse_copy_location(const std::string_view& url_src,
54265426
params_str = url_src.substr(pos + 1);
54275427
}
54285428

5429+
if (name_str.empty()) {
5430+
return false;
5431+
}
54295432
if (name_str[0] == '/') // trim leading slash
54305433
name_str.remove_prefix(1);
54315434

0 commit comments

Comments
 (0)