From: Neil Horman Date: Thu, 24 Apr 2025 13:26:33 +0000 (-0400) Subject: Disable unterminated-string-initialization in strict-warnings X-Git-Tag: openssl-3.4.2~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdd32eca98f0f40560045f6a55cba6170560ed63;p=thirdparty%2Fopenssl.git Disable unterminated-string-initialization in strict-warnings Recently updated to fedora 42, which includes an updated gcc, which triggers a new warning: test/afalgtest.c:44:9: error: initializer-string for array of 'unsigned char' truncates NUL terminator but destination lacks 'nonstring' attribute (18 chars into 17 available) [-Werror=unterminated-string-initialization] 44 | "\x53\x69\x6e\x67\x6c\x65\x20\x62\x6c\x6f\x63\x6b\x20\x6d\x73\x67" The warning occurs because in some locations we create char buffers of length X, and fill it with X bytes of data, truncating the NULL terminator. We could fix it by adding the nonstring attribute, but given that: 1) Adding attributes might impact other platforms that don't understand the attribute. 2) We often create char buffers that don't expect a NULL terminator. 3) Converting the unsigned char arrays to uint8_t, or other types that could be interpreted as non-strings has no impact, only applying the nonstring attribute silences the warning. It seems more sensible to just disable the warning entirely Reviewed-by: Saša Nedvědický Reviewed-by: Richard Levitte Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27490) (cherry picked from commit d08d77789e20e8b47a48f4d0a998ccfcde9d389b) --- diff --git a/Configure b/Configure index fff97bd6fc8..2e70ae50f22 100755 --- a/Configure +++ b/Configure @@ -166,6 +166,7 @@ my @gcc_devteam_warn = qw( -Wextra -Wno-unused-parameter -Wno-missing-field-initializers + -Wno-unterminated-string-initialization -Wswitch -Wsign-compare -Wshadow