Skip to content

Commit 095b814

Browse files
committed
aws_msk_iam: improve pointer safety in region extraction
Replace pointer comparison with offset comparison in VPC endpoint detection to improve safety and clarity. Changes 'p >= broker + 5' to 'p - broker >= 5' to properly check offset within string bounds before accessing p - 5. Signed-off-by: Arbin <[email protected]>
1 parent c88c54f commit 095b814

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/aws/flb_aws_msk_iam.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static flb_sds_t extract_region_from_broker(const char *broker)
177177
end = p; /* Points to .amazonaws.com */
178178

179179
/* Check for VPC endpoint format: .vpce.amazonaws.com */
180-
if (p >= broker + 5 && strncmp(p - 5, ".vpce", 5) == 0) {
180+
if (p - broker >= 5 && strncmp(p - 5, ".vpce", 5) == 0) {
181181
/* For VPC endpoints, region ends at .vpce */
182182
end = p - 5;
183183
}

0 commit comments

Comments
 (0)