[gnugo] Fix FTBFS with -Werror=format-security (#1037096, #1106693)

Yaakov Selkowitz yselkowitz at fedoraproject.org
Tue Jul 8 05:21:29 UTC 2014


commit cc1b2f77597a5c1c3a32fb1575cb8f2d17fae9af
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Thu Jul 3 22:05:40 2014 -0500

    Fix FTBFS with -Werror=format-security (#1037096, #1106693)

 gnugo-3.8-format-security.patch |   60 +++++++++++++++++++++++++++++++++++++++
 gnugo.spec                      |   15 ++++-----
 2 files changed, 67 insertions(+), 8 deletions(-)
---
diff --git a/gnugo-3.8-format-security.patch b/gnugo-3.8-format-security.patch
new file mode 100644
index 0000000..7828187
--- /dev/null
+++ b/gnugo-3.8-format-security.patch
@@ -0,0 +1,60 @@
+diff --git a/patterns/dfa.c b/patterns/dfa.c
+index 3689616..2d2f8c6 100644
+--- a/patterns/dfa.c
++++ b/patterns/dfa.c
+@@ -279,7 +279,7 @@ resize_dfa(dfa_t *pdfa, int max_states, int max_indexes)
+  * dump a dfa (debugging purpose).
+  */
+ 
+-static const char *line =
++static const char line[] =
+   "----------------------------------------------------\n";
+ 
+ void
+diff --git a/patterns/mkpat.c b/patterns/mkpat.c
+index 70a6964..5f1f1dd 100644
+--- a/patterns/mkpat.c
++++ b/patterns/mkpat.c
+@@ -1419,7 +1419,7 @@ generate_autohelper_code(int funcno, int number_of_params, int *labels)
+     /* A common case. Just use the labels as parameters. */
+     switch (number_of_params) {
+     case 0:
+-      code_pos += sprintf(code_pos, autohelper_functions[funcno].code);
++      code_pos += sprintf(code_pos, "%s", autohelper_functions[funcno].code);
+       break;
+     case 1:
+       code_pos += sprintf(code_pos, autohelper_functions[funcno].code,
+diff --git a/patterns/uncompress_fuseki.c b/patterns/uncompress_fuseki.c
+index 3290b05..c67a733 100644
+--- a/patterns/uncompress_fuseki.c
++++ b/patterns/uncompress_fuseki.c
+@@ -224,9 +224,9 @@ main(int argc, char *argv[])
+ 
+   assert(boardsize > 0);
+   if (boardsize > MAX_BOARD) {
+-    printf(output_strings[PREAMBLE]);
++    printf("%s", output_strings[PREAMBLE]);
+     printf(output_strings[HEADER], boardsize);
+-    printf(output_strings[FOOTER]);
++    printf("%s", output_strings[FOOTER]);
+     return EXIT_SUCCESS;
+   }
+   
+@@ -251,7 +251,7 @@ main(int argc, char *argv[])
+     board[k][boardsize + 1] = '|';
+   }
+ 
+-  printf(output_strings[PREAMBLE]);
++  printf("%s", output_strings[PREAMBLE]);
+   printf(output_strings[HEADER], boardsize);
+   
+ 
+@@ -308,7 +308,7 @@ main(int argc, char *argv[])
+   if (mode == C_OUTPUT)
+     write_pattern_c_code(NULL, board1d, NO_MOVE, 0, boardsize, -1);
+   
+-  printf(output_strings[FOOTER]);
++  printf("%s", output_strings[FOOTER]);
+ 
+   return EXIT_SUCCESS;
+ }
diff --git a/gnugo.spec b/gnugo.spec
index 066cb5a..54eb209 100644
--- a/gnugo.spec
+++ b/gnugo.spec
@@ -1,6 +1,6 @@
 Name:           gnugo
 Version:        3.8
-Release:        8%{?dist}
+Release:        9%{?dist}
 
 Summary:        Text based go program
 
@@ -8,7 +8,7 @@ Group:          Amusements/Games
 License:        GPLv3+
 URL:            http://www.gnu.org/software/gnugo/gnugo.html
 Source0:        http://ftp.gnu.org/gnu/gnugo/gnugo-%{version}.tar.gz
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Patch0:         gnugo-3.8-format-security.patch
 
 BuildRequires:  ncurses-devel readline-devel
 BuildRequires:  texinfo
@@ -23,8 +23,8 @@ on the Legend Go Server in Taiwan and the WING server in Japan.
 
 
 %prep
-rm -rf ${RPM_BUILD_ROOT}
 %setup -q
+%patch0 -p1
 # convert docs to UTF-8
 for f in AUTHORS THANKS; do
   iconv -f iso8859-1 -t utf-8 $f > $f.conv
@@ -39,13 +39,9 @@ make %{?_smp_mflags}
 
 
 %install
-rm -rf ${RPM_BUILD_ROOT}
 make DESTDIR=${RPM_BUILD_ROOT} install
 rm -f ${RPM_BUILD_ROOT}/%{_infodir}/dir
 
-%clean
-rm -rf ${RPM_BUILD_ROOT}
-
 
 %post
 /sbin/install-info %{_infodir}/%{name}.info.gz %{_infodir}/dir || :
@@ -58,7 +54,6 @@ fi
 
 
 %files
-%defattr(-,root,root,755)
 %doc AUTHORS COPYING ChangeLog NEWS README TODO THANKS doc/newlogo.jpg doc/oldlogo.jpg
 %doc %{_mandir}/man6/*
 %{_bindir}/*
@@ -66,6 +61,10 @@ fi
 
 
 %changelog
+* Thu Jul 03 2014 Yaakov Selkowitz <yselkowi at redhat.com> - 3.8-9
+- Fix FTBFS with -Werror=format-security (#1037096, #1106693)
+- Cleanup spec
+
 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.8-8
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list