From a24113ca27b9d653c312b2209b147e49b24894d8 Mon Sep 17 00:00:00 2001 From: Nandor Kracser Date: Fri, 7 Aug 2026 15:15:36 +0200 Subject: [PATCH] fix: include for strncasecmp gcc 15 promotes implicit function declarations to errors, so the two strncasecmp() calls broke the build. Under -std=c99 glibc's string.h does not pull in strings.h, where POSIX declares it. Include it only in the standard-headers branch -- kernel builds go through SIGV4_SYSTEM_HEADER and get strncasecmp from linux/string.h. Cast the key to char * as aws_sigv4_strcmp() already does, so declaring the function doesn't just trade the error for -Wpointer-sign. Fixes #6 --- sigv4.c | 4 ++-- sigv4.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sigv4.c b/sigv4.c index d01f944..ed93a58 100644 --- a/sigv4.c +++ b/sigv4.c @@ -274,7 +274,7 @@ static void get_signed_headers(aws_sigv4_params_t *sigv4_params, for (i = 0; i < sigv4_params->num_headers && num_headers < AWS_SIGV4_MAX_NUM_HEADERS; i++) { // check if the header is x-amz-content-sha256 - if (strncasecmp(sigv4_params->headers[i].key.data, "x-amz-content-sha256", sigv4_params->headers[i].key.len) == 0) + if (strncasecmp((char *)sigv4_params->headers[i].key.data, "x-amz-content-sha256", sigv4_params->headers[i].key.len) == 0) { has_amz_content_sha256_header = true; } @@ -323,7 +323,7 @@ static void get_canonical_headers(aws_sigv4_params_t *sigv4_params, for (i = 0; i < sigv4_params->num_headers && num_headers < AWS_SIGV4_MAX_NUM_HEADERS; i++) { // check if the header is x-amz-content-sha256 - if (strncasecmp(sigv4_params->headers[i].key.data, "x-amz-content-sha256", sigv4_params->headers[i].key.len) == 0) + if (strncasecmp((char *)sigv4_params->headers[i].key.data, "x-amz-content-sha256", sigv4_params->headers[i].key.len) == 0) { amz_content_sha256_header = &sigv4_params->headers[i]; } diff --git a/sigv4.h b/sigv4.h index 177ce3b..19ed6a2 100644 --- a/sigv4.h +++ b/sigv4.h @@ -13,6 +13,7 @@ #include #include #include +#include /* strncasecmp; not pulled in by string.h under -std=c99 */ #include #endif