Skip to content

interactive.c %5d may truncate #316

Description

@knight-ryu12

Seemingly that if I run make on the current master branch, error is generated.

Building with: Version string: unknown Architecture: x86_64 DSP mix: x86 RTLSDR support: yes BladeRF support: no HackRF support: no LimeSDR support: no SoapySDR support: no cc -I. -D_POSIX_C_SOURCE=200112L -DMODES_DUMP1090_VERSION=\"unknown\" -DMODES_DUMP1090_VARIANT=\"dump1090-fa\" -D_DEFAULT_SOURCE -DENABLE_CPUFEATURES -Icpu_features/include -DENABLE_RTLSDR -DSTARCH_MIX_X86 -O3 -g -std=c11 -fno-common -Wall -Wmissing-declarations -Werror -Wformat-signedness -W -I/usr/include/ -c interactive.c -o interactive.o interactive.c: In function ‘interactiveShowData’: interactive.c:334:49: error: ‘%5d’ directive output may be truncated writing between 5 and 11 bytes into a region of size 7 [-Werror=format-truncation=] 334 | snprintf(strFl, sizeof(strFl), "%5d ", convert_altitude(modeC * 100)); | ^~~ interactive.c:334:48: note: directive argument in the range [-2147483648, 2147483644] 334 | snprintf(strFl, sizeof(strFl), "%5d ", convert_altitude(modeC * 100)); | ^~~~~~ interactive.c:334:17: note: ‘snprintf’ output between 7 and 13 bytes into a destination of size 7 334 | snprintf(strFl, sizeof(strFl), "%5d ", convert_altitude(modeC * 100)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors

cc -v outputs follows:
Using built-in specs. COLLECT_GCC=cc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/16/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust,cobol --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-gcc-major-version-only --with-linker-hash-style=gnu --with-system-zlib --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-fixincludes --disable-libssp --disable-libstdcxx-pch --disable-werror Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 16.1.1 20260728 (GCC)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions