fix-Wformat-security-warnings.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From 1bc9cac45be4bac46f58e325779bdb8c7b7bf502 Mon Sep 17 00:00:00 2001
  2. From: Michael Orlitzky <michael@orlitzky.com>
  3. Date: Tue, 23 Aug 2016 20:20:15 -0400
  4. Subject: [PATCH 1/1] Fix format-security warnings.
  5. Newer versions of GCC have the ability to warn you (or throw errors)
  6. about insecure format strings. Generally this is due to an omitted
  7. format string in the printf family of functions, and a few of those
  8. issues existed in the code base. They were all fixed by adding a
  9. trivial "%s" format string. The project now builds with
  10. -Werror=format-security.
  11. ---
  12. curses/cursesterm.c | 4 ++--
  13. lib5250/sslstream.c | 2 +-
  14. lib5250/telnetstr.c | 2 +-
  15. 3 files changed, 4 insertions(+), 4 deletions(-)
  16. diff --git a/curses/cursesterm.c b/curses/cursesterm.c
  17. index bf20f05..3032966 100644
  18. --- a/curses/cursesterm.c
  19. +++ b/curses/cursesterm.c
  20. @@ -640,9 +640,9 @@ static void curses_terminal_update(Tn5250Terminal * This, Tn5250Display *display
  21. if(This->data->is_xterm) {
  22. if (This->data->font_132!=NULL) {
  23. if (tn5250_display_width (display)>100)
  24. - printf(This->data->font_132);
  25. + printf("%s", This->data->font_132);
  26. else
  27. - printf(This->data->font_80);
  28. + printf("%s", This->data->font_80);
  29. }
  30. printf ("\x1b[8;%d;%dt", tn5250_display_height (display)+1,
  31. tn5250_display_width (display));
  32. diff --git a/lib5250/sslstream.c b/lib5250/sslstream.c
  33. index 2f91d1a..7f3009e 100644
  34. --- a/lib5250/sslstream.c
  35. +++ b/lib5250/sslstream.c
  36. @@ -307,7 +307,7 @@ static void ssl_log_SB_buf(unsigned char *buf, int len)
  37. if (!tn5250_logfile)
  38. return;
  39. - fprintf(tn5250_logfile,ssl_getTelOpt(type=*buf++));
  40. + fprintf(tn5250_logfile,"%s",ssl_getTelOpt(type=*buf++));
  41. switch (c=*buf++) {
  42. case IS:
  43. fputs("<IS>",tn5250_logfile);
  44. diff --git a/lib5250/telnetstr.c b/lib5250/telnetstr.c
  45. index 9ad2624..cf1576f 100644
  46. --- a/lib5250/telnetstr.c
  47. +++ b/lib5250/telnetstr.c
  48. @@ -282,7 +282,7 @@ static void log_SB_buf(unsigned char *buf, int len)
  49. if (!tn5250_logfile)
  50. return;
  51. - fprintf(tn5250_logfile,getTelOpt(type=*buf++));
  52. + fprintf(tn5250_logfile,"%s",getTelOpt(type=*buf++));
  53. switch (c=*buf++) {
  54. case IS:
  55. fputs("<IS>",tn5250_logfile);
  56. --
  57. 2.7.3