Skip to content

Conversation

@kretcheu
Copy link
Contributor

@kretcheu kretcheu commented Oct 9, 2021

When compiling with [-Werror=format-security] in Debian packaging occurs this error:

cui.cpp: In function ‘void show_ncurses(Line**, int)’:                                          
cui.cpp:377:73: error: format not a string literal and no format arguments [-Werror=format-security]
  377 |   mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, desc_view_mode[viewMode]);              
      |                                                                         ^               
cui.cpp:379:29: warning: zero-length gnu_printf format string [-Wformat-zero-length]            
  379 |   mvprintw(totalrow + 1, 0, "");                                                        
      |                             ^~      

This patch solve the problem.

[]'s
kretcheu

When compiling with [-Werror=format-security] in Debian packaging occurs this error:
```
cui.cpp: In function ‘void show_ncurses(Line**, int)’:                                          
cui.cpp:377:73: error: format not a string literal and no format arguments [-Werror=format-security]
  377 |   mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, desc_view_mode[viewMode]);              
      |                                                                         ^               
cui.cpp:379:29: warning: zero-length gnu_printf format string [-Wformat-zero-length]            
  379 |   mvprintw(totalrow + 1, 0, "");                                                        
      |                             ^~      
```

This patch solve the problem.

[]'s
kretcheu
mvprintw(totalrow, 0, " TOTAL %-*.*s %-*.*s %11.3f %11.3f ",
proglen, proglen, "", devlen, devlen, "", sent_global, recv_global);
mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, desc_view_mode[viewMode]);
mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, "%s", desc_view_mode[viewMode]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, "%s", desc_view_mode[viewMode]);
attroff(A_REVERSE);
mvprintw(totalrow + 1, 0, "");
mvprintw(totalrow + 1, 0, "%s", "");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda weird, isn't there another way that would avoid the warning but not make things unnecessarily more complicated? Anyway, OK I guess ;)

@raboof raboof merged commit 168d342 into raboof:main Oct 11, 2021
@raboof
Copy link
Owner

raboof commented Oct 11, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants