Skip to content

Commit ef1111a

Browse files
committed
rgw_sigv4: handle '0;' as trailer-chunk boundary
https://tracker.ceph.com/issues/64676 Signed-off-by: matt benjamin <[email protected]>
1 parent 3e302ab commit ef1111a

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/rgw/rgw_auth_s3.cc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,11 +1552,21 @@ bool AWSv4ComplMulti::complete()
15521552
std::string_view expected_trailer_signature;
15531553
std::string calculated_trailer_signature;
15541554

1555-
/* the trailer boundary is just "\r\n0" when we have no trailer
1556-
* signature */
1555+
/* I have seen variations in the 0-byte case, with and without
1556+
* ssl transport. I have observed "\r\n0;" but also "0;" in the
1557+
* trailer-signature case. I have observed only "\r\n0" in the
1558+
* no-trailer-signature case--but assume "0" might be possible.
1559+
* The logic below handles all 4 cases. */
15571560
if (tbuf_pos > sarrlen("\r\n0")) {
1558-
auto trailer_off = sarrlen("\r\n0");
1559-
if (*(trailer_vec.data() + trailer_off) == ';') {
1561+
const char* tv_data = trailer_vec.data();
1562+
auto trailer_off = 0;
1563+
if (*(tv_data + trailer_off) == '\r') {
1564+
trailer_off += 2;
1565+
}
1566+
if (*(tv_data + trailer_off) == '0') {
1567+
++trailer_off;
1568+
}
1569+
if (*(tv_data + trailer_off) == ';') {
15601570
++trailer_off;
15611571
}
15621572
const std::string_view sv_trailer(

0 commit comments

Comments
 (0)