]> git.ipfire.org Git - thirdparty/openssl.git/commit
Disable unterminated-string-initialization in strict-warnings
authorNeil Horman <nhorman@openssl.org>
Thu, 24 Apr 2025 13:26:33 +0000 (09:26 -0400)
committerTomas Mraz <tomas@openssl.org>
Fri, 2 May 2025 11:43:34 +0000 (13:43 +0200)
commitf3eb9a744a538d34dfa35ff5a4b266a5aedb94cb
treef4eb171bc81ca7dcd8373d6c3600c3561b3a481f
parentdd9da9bb957a42e6c9059a534154a0ea43e0e814
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ý <sashan@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27490)

(cherry picked from commit d08d77789e20e8b47a48f4d0a998ccfcde9d389b)
Configure