On Tue, 10 Mar 2026 at 13:47, Fabiano Rosas <[email protected]> wrote: > This gives me: > > ../tests/qtest/ast2700-sgpio-test.c: In function ‘test_output_pins’: > ../tests/qtest/ast2700-sgpio-test.c:27:33: error: ‘sprintf’ may write a > terminating nul past the end of the destination > [-Werror=format-overflow=] > > ../tests/qtest/ast2700-sgpio-test.c: In function ‘test_irq_level_high’: > ../tests/qtest/ast2700-sgpio-test.c:85:33: error: ‘sprintf’ may write a > terminating nul past the end of the destination > [-Werror=format-overflow=] > > ../tests/qtest/arm-cpu-features.c: In function > ‘test_query_cpu_model_expansion_kvm’: > ../tests/qtest/arm-cpu-features.c:578:35: error: ‘%u’ directive writing > between 1 and 10 bytes into a region of size 5 > [-Werror=format-overflow=] > > ../configure > --target-list=x86_64-softmmu,i386-softmmu,aarch64-softmmu,arm-softmmu,ppc64-softmmu,s390x-softmmu,riscv64-softmmu,aarch64-linux-user,loongarch64-softmmu > --disable-plugins --enable-modules --enable-werror > --enable-trace-backends=log,dtrace --enable-debug --enable-docs > --enable-rust --enable-strict-rust-lints > > gcc version 7.5.0 (SUSE Linux)
This is quite an old GCC, so it's probably less good at noticing when there might be an overflow and when not (or it has bugs that have been fixed in subsequent versions). For all of these examples, it would be fine and I think also better to use g_strdup_printf() to create the strings rather than a fixed size array and sprintf(). -- PMM
