Conversation
added 3 commits
August 1, 2026 09:49
char spinner[4] = "|/-\\" truncates the NUL terminator, which newer GCC (13+) flags as -Werror=unterminated-string-initialization, breaking the build on distros with modern toolchains (e.g. Ubuntu 24.04+). Array only needs to grow to 5; the read loop already indexes with % 4 so behavior is unchanged.
Same class of bug as the previous commit: ais_charset[64] and base40_alphabet[40] are each one byte too small to hold their string literal's NUL terminator. GCC 15's -Wunterminated-string-initialization (part of -Wall) flags these as errors under -Werror. All access sites use bounded bit-field indices (0-63 and mod-40 respectively), so growing the arrays by one byte is behavior-neutral.
Missed in the previous commit: ais_charset.h declares extern char ais_charset[64], which now conflicts with the [65] definition in ais_charset.c.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The build fails on toolchains with GCC 15+ (e.g. Ubuntu 24.10+/25.04+/26.04) due to
-Wunterminated-string-initialization, a new warning in GCC 15 that's part of-Walland gets promoted to a hard error by this project's
-Werror.Three fixed-size
chararrays are initialized with string literals sized to fit thevisible characters but not the NUL terminator GCC also wants space for:
interactive.c:spinner[4] = "|/-\\"(4 visible chars, needs 5)uat2esnt/uat_decode.c:base40_alphabet[40] = "0123... .."(40 visible chars, needs 41)ais_charset.c/ais_charset.h:ais_charset[64] = "@ABC...>?"(64 visible chars, needs 65)Fix
Grow each array by one byte to hold the terminator. I checked every read site for all
three arrays before changing sizes:
spinneris indexed via% 4ininteractive.c— unaffected by growing to 5.base40_alphabetis indexed via% 40inuat_decode.c— unaffected by growing to 41.ais_charsetis indexed by 6-bit bitfields (0–63) acrosscomm_b.c,mode_s.c, andnet_io.c— unaffected by growing to 65.No behavior changes; this is purely a build-compatibility fix. I found all three
instances by scanning the source tree for
char arr[N] = "literal"where the literal'slength + 1 exceeds
N, so this should be the complete set of build breaks from thiswarning.
Testing
Built clean on Ubuntu 26.04 (aarch64, GCC 15) where it previously failed at each of
these three spots in sequence. Also confirmed no other instances of this pattern exist
in the tree.