0001-idn-format-security-warnings.patch 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. Subject: [PATCH] idn: fix printf() format security warnings
  2. MIME-Version: 1.0
  3. Content-Type: text/plain; charset=UTF-8
  4. Content-Transfer-Encoding: 8bit
  5. | ../../libidn-1.32/src/idn.c: In function 'main':
  6. | ../../libidn-1.32/src/idn.c:172:7: error: format not a string literal and no format arguments [-Werror=format-security]
  7. | error (0, 0, _("only one of -s, -e, -d, -a, -u or -n can be specified"));
  8. | ^~~~~
  9. | ../../libidn-1.32/src/idn.c:187:5: error: format not a string literal and no format arguments [-Werror=format-security]
  10. | fprintf (stderr, _("Type each input string on a line by itself, "
  11. | ^~~~~~~
  12. | ../../libidn-1.32/src/idn.c:202:4: error: format not a string literal and no format arguments [-Werror=format-security]
  13. | error (EXIT_FAILURE, errno, _("input error"));
  14. | ^~~~~
  15. | ../../libidn-1.32/src/idn.c:220:8: error: format not a string literal and no format arguments [-Werror=format-security]
  16. | _("could not convert from UTF-8 to UCS-4"));
  17. | ^
  18. | ../../libidn-1.32/src/idn.c:245:8: error: format not a string literal and no format arguments [-Werror=format-security]
  19. | _("could not convert from UTF-8 to UCS-4"));
  20. | ^
  21. | ../../libidn-1.32/src/idn.c:281:6: error: format not a string literal and no format arguments [-Werror=format-security]
  22. | _("could not convert from UTF-8 to UCS-4"));
  23. | ^
  24. | ../../libidn-1.32/src/idn.c:340:6: error: format not a string literal and no format arguments [-Werror=format-security]
  25. | _("could not convert from UCS-4 to UTF-8"));
  26. | ^
  27. | ../../libidn-1.32/src/idn.c:364:6: error: format not a string literal and no format arguments [-Werror=format-security]
  28. | _("could not convert from UCS-4 to UTF-8"));
  29. | ^
  30. | ../../libidn-1.32/src/idn.c:442:8: error: format not a string literal and no format arguments [-Werror=format-security]
  31. | _("could not convert from UCS-4 to UTF-8"));
  32. | ^
  33. | ../../libidn-1.32/src/idn.c:498:6: error: format not a string literal and no format arguments [-Werror=format-security]
  34. | _("could not convert from UTF-8 to UCS-4"));
  35. | ^
  36. | ../../libidn-1.32/src/idn.c:527:5: error: format not a string literal and no format arguments [-Werror=format-security]
  37. | _("could not convert from UTF-8 to UCS-4"));
  38. | ^
  39. | ../../libidn-1.32/src/idn.c:540:6: error: format not a string literal and no format arguments [-Werror=format-security]
  40. | error (EXIT_FAILURE, 0, _("could not do NFKC normalization"));
  41. | ^~~~~
  42. | ../../libidn-1.32/src/idn.c:551:5: error: format not a string literal and no format arguments [-Werror=format-security]
  43. | _("could not convert from UTF-8 to UCS-4"));
  44. | ^
  45. Signed-off-by: André Draszik <adraszik@tycoint.com>
  46. Signed-off-by: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
  47. Upstream-Status: Pending
  48. ---
  49. src/idn.c | 27 ++++++++++++++-------------
  50. 1 file changed, 14 insertions(+), 13 deletions(-)
  51. diff --git a/src/idn.c b/src/idn.c
  52. index f2fee11..c6e5caa 100644
  53. --- a/src/idn.c
  54. +++ b/src/idn.c
  55. @@ -169,7 +169,7 @@ main (int argc, char *argv[])
  56. (args_info.idna_to_unicode_given ? 1 : 0) +
  57. (args_info.nfkc_given ? 1 : 0) != 1)
  58. {
  59. - error (0, 0,
  60. + error (0, 0, "%s",
  61. _("only one of -s, -e, -d, -a, -u or -n can be specified"));
  62. usage (EXIT_FAILURE);
  63. }
  64. @@ -183,7 +183,7 @@ main (int argc, char *argv[])
  65. if (!args_info.quiet_given
  66. && args_info.inputs_num == 0 && isatty (fileno (stdin)))
  67. - fprintf (stderr, _("Type each input string on a line by itself, "
  68. + fprintf (stderr, "%s", _("Type each input string on a line by itself, "
  69. "terminated by a newline character.\n"));
  70. do
  71. @@ -195,7 +195,7 @@ main (int argc, char *argv[])
  72. if (feof (stdin))
  73. break;
  74. - error (EXIT_FAILURE, errno, _("input error"));
  75. + error (EXIT_FAILURE, errno, "%s", _("input error"));
  76. }
  77. if (strlen (line) > 0)
  78. @@ -213,7 +213,7 @@ main (int argc, char *argv[])
  79. if (!q)
  80. {
  81. free (p);
  82. - error (EXIT_FAILURE, 0,
  83. + error (EXIT_FAILURE, 0, "%s",
  84. _("could not convert from UTF-8 to UCS-4"));
  85. }
  86. @@ -238,7 +238,7 @@ main (int argc, char *argv[])
  87. if (!q)
  88. {
  89. free (r);
  90. - error (EXIT_FAILURE, 0,
  91. + error (EXIT_FAILURE, 0, "%s",
  92. _("could not convert from UTF-8 to UCS-4"));
  93. }
  94. @@ -275,7 +275,7 @@ main (int argc, char *argv[])
  95. q = stringprep_utf8_to_ucs4 (p, -1, &len);
  96. free (p);
  97. if (!q)
  98. - error (EXIT_FAILURE, 0,
  99. + error (EXIT_FAILURE, 0, "%s",
  100. _("could not convert from UTF-8 to UCS-4"));
  101. if (args_info.debug_given)
  102. @@ -334,7 +334,7 @@ main (int argc, char *argv[])
  103. r = stringprep_ucs4_to_utf8 (q, -1, NULL, NULL);
  104. free (q);
  105. if (!r)
  106. - error (EXIT_FAILURE, 0,
  107. + error (EXIT_FAILURE, 0, "%s",
  108. _("could not convert from UCS-4 to UTF-8"));
  109. p = stringprep_utf8_to_locale (r);
  110. @@ -358,7 +358,7 @@ main (int argc, char *argv[])
  111. q = stringprep_utf8_to_ucs4 (p, -1, NULL);
  112. free (p);
  113. if (!q)
  114. - error (EXIT_FAILURE, 0,
  115. + error (EXIT_FAILURE, 0, "%s",
  116. _("could not convert from UCS-4 to UTF-8"));
  117. if (args_info.debug_given)
  118. @@ -436,7 +436,7 @@ main (int argc, char *argv[])
  119. if (!q)
  120. {
  121. free (p);
  122. - error (EXIT_FAILURE, 0,
  123. + error (EXIT_FAILURE, 0, "%s",
  124. _("could not convert from UCS-4 to UTF-8"));
  125. }
  126. @@ -492,7 +492,7 @@ main (int argc, char *argv[])
  127. r = stringprep_ucs4_to_utf8 (q, -1, NULL, NULL);
  128. free (q);
  129. if (!r)
  130. - error (EXIT_FAILURE, 0,
  131. + error (EXIT_FAILURE, 0, "%s",
  132. _("could not convert from UTF-8 to UCS-4"));
  133. p = stringprep_utf8_to_locale (r);
  134. @@ -521,7 +521,7 @@ main (int argc, char *argv[])
  135. if (!q)
  136. {
  137. free (p);
  138. - error (EXIT_FAILURE, 0,
  139. + error (EXIT_FAILURE, 0, "%s",
  140. _("could not convert from UTF-8 to UCS-4"));
  141. }
  142. @@ -535,7 +535,8 @@ main (int argc, char *argv[])
  143. r = stringprep_utf8_nfkc_normalize (p, -1);
  144. free (p);
  145. if (!r)
  146. - error (EXIT_FAILURE, 0, _("could not do NFKC normalization"));
  147. + error (EXIT_FAILURE, 0, "%s",
  148. + _("could not do NFKC normalization"));
  149. if (args_info.debug_given)
  150. {
  151. @@ -545,7 +546,7 @@ main (int argc, char *argv[])
  152. if (!q)
  153. {
  154. free (r);
  155. - error (EXIT_FAILURE, 0,
  156. + error (EXIT_FAILURE, 0, "%s",
  157. _("could not convert from UTF-8 to UCS-4"));
  158. }
  159. --
  160. 2.25.1