Skip to content

Commit

Permalink
Fix invalid memory access in S3 comms (#3681)
Browse files Browse the repository at this point in the history
In the ros3 VFD, passing an empty string parameter to an internal
API call could result in accessing the -1th element of a string.
This would cause failures on big-endian systems like s390x.

This parameter is now checked before writing to the string.

Fixes GitHub #1168
  • Loading branch information
derobins authored Oct 16, 2023
1 parent ccb1a91 commit 8550798
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/H5FDs3comms.c
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,8 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c
} /* end while node is not NULL */

/* remove trailing ';' from signed headers sequence */
signed_headers_dest[strlen(signed_headers_dest) - 1] = '\0';
if (*signed_headers_dest != '\0')
signed_headers_dest[strlen(signed_headers_dest) - 1] = '\0';

/* append signed headers and payload hash
* NOTE: at present, no HTTP body is handled, per the nature of
Expand Down

0 comments on commit 8550798

Please sign in to comment.