Menu

#110 Make compile with -Werror=format-security

Unstable (example)
closed-fixed
None
5
2022-10-21
2022-10-21
No

Fedora compilation uses -Werror=format-security and with this ngspice https://sourceforge.net/p/ngspice/ngspice/ci/27ba1e39dfc92fae3f7fff190b773a6a6cf7cb30/ does not compile like:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I../../../src/include -I../../../src/include -DUSE_INTERP_RESULT -I/usr/include -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-se
curity -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fst
ack-clash-protection -fcf-protection -I/usr/include/blt -I/usr/include -fopenmp -MT evtcheck_nodes.lo -MD -MP -MF .deps/evtcheck_nodes.Tpo -c evtcheck_nodes.c  -fPIC -DPIC -o .libs/evtcheck_nodes.o
evtcheck_nodes.c: In function 'find_bridge':
evtcheck_nodes.c:490:13: error: format not a string literal and no format arguments [-Werror=format-security]
  490 |             snprintf(dot + 1, sizeof buff - (size_t)(dot - buff), vcc_parm);
      |             ^~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [Makefile:481: evtcheck_nodes.lo] Error 1

The attached patch should fix this issue.

1 Attachments

Discussion

  • Holger Vogt

    Holger Vogt - 2022-10-21
    • status: open --> closed-fixed
    • assigned_to: Holger Vogt
     
  • Holger Vogt

    Holger Vogt - 2022-10-21

    Mamoru,

    thanks for the patch.

    Applied to git branch pre-master.

    Holger

     

Log in to post a comment.

MongoDB Logo MongoDB