rricharz / Tek4010

Free Tektronix 4010, 4013, 4014 and 4015 terminal emulator for Raspberry Pi, Linux, macOS (Macintosh) and Windows
GNU General Public License v3.0
244 stars 29 forks source link

Fix clang warning regarding printf #58

Closed tvrusso closed 5 months ago

tvrusso commented 5 months ago

In tube.c, a use of "printf(helpstr)" was flagged by clang (the default compiler on FreeBSD and macOS) as potentially insecure. The insecurity of this is probably insignificant, but fixing it removes a warning from compilation.

The warning is:

   src/tube.c:303:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
  303 |                 printf(helpStr);
      |                        ^~~~~~~
src/tube.c:303:24: note: treat the string as an argument to avoid this
  303 |                 printf(helpStr);
      |                        ^

All that need be done is to provide a format string that is a string literal, with helpStr being the string to print instead of the format string.