]> git.ipfire.org Git - thirdparty/tvheadend.git/commit
wizard: increase buffer size to silence -Wformat-truncation on GCC 15
authorJames Hutchinson <jahutchinson99@googlemail.com>
Wed, 7 May 2025 09:20:52 +0000 (10:20 +0100)
committerFlole <Flole998@users.noreply.github.com>
Tue, 13 May 2025 22:55:24 +0000 (00:55 +0200)
commitcebe6159042c0782cbe22d26446b141fa07d43b8
treed57ac5ee9fdb235623da133b66bee4acbe6a83ca
parentdf4eaf8e1913028c5cccd6320e462069382b6720
wizard: increase buffer size to silence -Wformat-truncation on GCC 15

GCC 15.1 introduces stricter checks around `snprintf`-like functions
under `-Wformat-truncation`, even when the format string itself is
under developer control. This triggers a false positive in
`hello_changed()` when building with `-Werror=format-truncation`:

  error: ‘__builtin___snprintf_chk’ output may be truncated before the
  last format character [-Werror=format-truncation=]

  note: output between 1 and 33 bytes into a destination of size 32

This warning is triggered due to a theoretical edge case in
`tvh_strlcatf()` where combining strings like `"en,fr,de"` could
approach the buffer limit of 32 bytes. While truncation is unlikely in
practice, the warning is still emitted aggressively by the new FORTIFY
logic.

Increase the buffer from 32 to 64 bytes to silence the warning and
ensure headroom. This avoids having to disable the diagnostic, while
still keeping the logic and usage intact. This is a defensive fix with
no behavioral change, and aligns with similar mitigations used in other
projects facing the same issue with GCC >= 13 and especially 15+.

Tested with GCC 15.1.1, built cleanly.

Refs:
- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231
- https://gcc.gnu.org/onlinedocs/gcc-15.1.0/gcc/Warning-Options.html#index-Wformat-truncation
src/wizard.c