Home
       ttyclock.c: always use "%s"-style format for printf()-style functions - tty-clock - port of tty-clock to OpenBSD, with pledge/unveil added as goodie.
  HTML git clone https://git.drkhsh.at/tty-clock.git
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 4cfd73080da1964557484da620c401745d73881c
   DIR parent 9e00c32098524c30dac4dab701f7e33f8bc7c880
  HTML Author: Sergei Trofimovich <slyich@gmail.com>
       Date:   Thu,  4 Nov 2021 08:54:32 +0000
       
       ttyclock.c: always use "%s"-style format for printf()-style functions
       
       `ncuses-6.3` added printf-style function attributes and now makes
       it easier to catch cases when user input is used in palce of format
       string when built with CFLAGS=-Werror=format-security:
       
           ttyclock.c:270:71: error: format not a string literal and no format arguments [-Werror=format-security]
             270 |           mvwprintw(ttyclock.datewin, (DATEWINH / 2), 1, ttyclock.date.datestr);
                 |                                                          ~~~~~~~~~~~~~^~~~~~~~
       
       Let's wrap all the missing places with "%s" format.
       
       Diffstat:
         M ttyclock.c                          |       2 +-
       
       1 file changed, 1 insertion(+), 1 deletion(-)
       ---
   DIR diff --git a/ttyclock.c b/ttyclock.c
       @@ -267,7 +267,7 @@ draw_clock(void)
             if (ttyclock.option.date)
             {
                  wbkgdset(ttyclock.datewin, (COLOR_PAIR(2)));
       -          mvwprintw(ttyclock.datewin, (DATEWINH / 2), 1, ttyclock.date.datestr);
       +          mvwprintw(ttyclock.datewin, (DATEWINH / 2), 1, "%s", ttyclock.date.datestr);
                  wrefresh(ttyclock.datewin);
             }