[saoimage] Fix build with -Werror=format-security

Lubomir Rintel lkundrak at fedoraproject.org
Wed Dec 4 22:42:49 UTC 2013


commit 67c67b05ee0c7b48269fcf827b88a4577a9595a7
Author: Lubomir Rintel <lkundrak at v3.sk>
Date:   Wed Dec 4 23:42:43 2013 +0100

    Fix build with -Werror=format-security

 saoimage-1.35.1-formatsec.patch |   74 +++++++++++++++++++++++++++++++++++++++
 saoimage.spec                   |    8 ++++-
 2 files changed, 81 insertions(+), 1 deletions(-)
---
diff --git a/saoimage-1.35.1-formatsec.patch b/saoimage-1.35.1-formatsec.patch
new file mode 100644
index 0000000..92b435f
--- /dev/null
+++ b/saoimage-1.35.1-formatsec.patch
@@ -0,0 +1,74 @@
+From de0b39a6cfffe2757ae7837ade3ad82b002a8a64 Mon Sep 17 00:00:00 2001
+From: Lubomir Rintel <lkundrak at v3.sk>
+Date: Wed, 4 Dec 2013 23:19:37 +0100
+Subject: [PATCH] Fix build with -Werror=format-security
+
+Fedora, starting with version 21, will enable this flag in order to limit
+potentially insecure uses of format strings. It is required for format strings
+to be constant now.
+---
+ iraffdbk.c | 6 +++---
+ mainbffr.c | 2 +-
+ mgfytabl.c | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/iraffdbk.c b/iraffdbk.c
+index e685fe5..29f4741 100644
+--- a/iraffdbk.c
++++ b/iraffdbk.c
+@@ -118,7 +118,7 @@ void send_curpos_to_iraf ( fileX, fileY, frameno, z, key, strval )
+   int write_connection();
+ 
+   if( control.IRAF_out.open == 0 ) {
+-    (void)fprintf(stderr, NO_OUT_MSG);
++    (void)fputs(NO_OUT_MSG, stderr);
+     return;
+   }
+   if( key == EOF ) {
+@@ -158,7 +158,7 @@ void set_curpos_to_iraf_trigger ( frameno, z )
+   void set_trigger_key_mouse(), set_iraf_key_trigger();
+ 
+   if( control.IRAF_out.open == 0 ) {
+-    (void)fprintf(stderr, NO_OUT_MSG);
++    (void)fputs(NO_OUT_MSG, stderr);
+     return;
+   }
+   if( trigger_request_count == 0 ) {
+@@ -189,7 +189,7 @@ int trigger_curpos_to_iraf ( event, key )
+   void make_cursor();
+ 
+   if( control.IRAF_out.open == 0 ) {
+-    (void)fprintf(stderr, NO_OUT_MSG);
++    (void)fputs(NO_OUT_MSG, stderr);
+     return(0);
+   }
+   /* Map ctrl/d and ctrl/z into EOF. */
+diff --git a/mainbffr.c b/mainbffr.c
+index 067bf16..e3de669 100644
+--- a/mainbffr.c
++++ b/mainbffr.c
+@@ -200,7 +200,7 @@ int init_imagebuf ()
+ 	buffer.filebuf = NULL;
+ 	buffer.filebuf_sz = 0;
+       }
+-      (void)fprintf(stderr, imgbuf_error);
++      (void)fputs(imgbuf_error, stderr);
+       buffer.load_filebuf = 0;
+       return( 0 );
+     }
+diff --git a/mgfytabl.c b/mgfytabl.c
+index a38b7aa..45ffe32 100644
+--- a/mgfytabl.c
++++ b/mgfytabl.c
+@@ -150,7 +150,7 @@ static void output_column_labels ( xarray, cols, col_width, filex )
+     format[i] = '-';
+   format[col_width] = '\0';
+   for( i=0; i<cols; i++)
+-    (void)printf(format);
++    (void)puts(format);
+ }
+ 
+ /*
+-- 
+1.8.4.2
+
diff --git a/saoimage.spec b/saoimage.spec
index 339f1ec..cacd02d 100644
--- a/saoimage.spec
+++ b/saoimage.spec
@@ -1,6 +1,6 @@
 Name:           saoimage
 Version:        1.35.1
-Release:        14%{?dist}
+Release:        15%{?dist}
 Summary:        Utility for displaying astronomical images
 
 Group:          Amusements/Graphics
@@ -15,6 +15,8 @@ Patch1:         saoimage-1.35.1-pad.patch
 Patch2:         saoimage-1.35.1-mkstemp.patch
 Patch3:         saoimage-1.35.1-inc.patch
 Patch4:         saoimage-1.35.1-bpp.patch
+# Submitted by e-mail to dmink at cfa.harvard.edu
+Patch5:         saoimage-1.35.1-formatsec.patch
 
 BuildRequires:  libX11-devel
 BuildRequires:  /usr/bin/pdflatex
@@ -48,6 +50,7 @@ A color table graph window can be brought up by clicking on the color bar.
 %patch2 -p1 -b .mkstemp
 %patch3 -p1 -b .inc
 %patch4 -p1 -b .bpp
+%patch5 -p1 -b .formatsec
 
 
 %build
@@ -103,6 +106,9 @@ update-desktop-database &> /dev/null || :
 
 
 %changelog
+* Wed Dec 04 2013 Lubomir Rintel <lkundrak at v3.sk> - 1.35.1-15
+- Fix build with -Werror=format-security
+
 * Thu Oct 24 2013 Lubomir Rintel <lkundrak at v3.sk> - 1.35.1-14
 - Bulk sad and useless attempt at consistent SPEC file formatting
 


More information about the scm-commits mailing list