awslabs / aws-c-s3

C99 library implementation for communicating with the S3 service, designed for maximizing throughput on high bandwidth EC2 instances.
Apache License 2.0
94 stars 38 forks source link

Issue about possible mistake "bad copypast" #357

Closed Bbulatov closed 10 months ago

Bbulatov commented 10 months ago

Describe the bug

Hello! During the static analysis process, a suspicion of a bad copypast error was identified in s3_util.c:208. There is no changes between two blocks (192-196 and 208-214 lines), but in 192 and 208 lines the same instruction: "if (signing_config->service.len > 0) {". I think there should be signed_body_value instead of service in line 208.Please clarify is this right?

Expected Behavior

In line 208: if (signing_config->signed_body_value.len > 0) {

Current Behavior

In line 208: if (signing_config->service.len > 0) {

Reproduction Steps

This occurs when calling

struct aws_cached_signing_config_aws aws_cached_signing_config_new( struct aws_allocator allocator, const struct aws_signing_config_aws *signing_config)

Possible Solution

Change "if (signing_config->service.len > 0) {" to "if (signing_config->signed_body_value.len > 0) {"

Additional Information/Context

No response

aws-c-s3 version used

v0.3.18

Compiler and version used

g++ 8.3.0

Operating System and version

OS Linux Debian

waahm7 commented 10 months ago

Thank you for creating the issue. We have fixed it in https://github.com/awslabs/aws-c-s3/releases/tag/v0.3.19.