-Werror=format-security

Xcas devel: interface utilisateur/user interface

Modérateur : xcasadmin

frederic han
Messages : 1137
Inscription : dim. mai 20, 2007 7:09 am
Localisation : Paris
Contact :

-Werror=format-security

Message par frederic han » dim. avr. 06, 2014 3:41 pm

Salut, si on compile avec -Werror=format-security comme sous fedora21 il y a quelques passages qui bloquent.
J'ai applique le patch suivant qui fonctionne:

Code : Tout sélectionner

diff -ruN src/History.cc src.new/History.cc
--- src/History.cc	2014-03-26 08:21:04.000000000 +0100
+++ src.new/History.cc	2014-04-04 15:53:34.631451481 +0200
@@ -1565,7 +1565,7 @@
   }
 
   int confirm_close(const string & message){
-    int i=fl_choice(message.c_str(),gettext("Cancel"),gettext("Yes"),gettext("No"));
+    int i=fl_choice("%s",gettext("Cancel"),gettext("Yes"),gettext("No"),message.c_str());
     return i;
   }
 
@@ -3079,9 +3079,10 @@
       char buf[1024];
       path=getcwd(buf,1024);
     }
-    system(("cd "+path+" ; latex "+s+" ").c_str());
-    system(("cd "+path+" ; xdvi "+s+" &").c_str());
-    system(("cd "+path+" ; dvips "+s+" -o "+s+".ps && pstopnm -stdout "+s+" | pnmtopng > "+s+".png").c_str()); 
+    int tmpresult;
+    tmpresult=system(("cd "+path+" ; latex "+s+" ").c_str());
+    tmpresult=system(("cd "+path+" ; xdvi "+s+" &").c_str());
+    tmpresult=system(("cd "+path+" ; dvips "+s+" -o "+s+".ps && pstopnm -stdout "+s+" | pnmtopng > "+s+".png").c_str()); 
     fl_message("%s",("->"+s+".tex/.dvi/.ps/.png").c_str());
 #endif //    
   }
@@ -3091,11 +3092,12 @@
     system((xcasroot()+"latex.bat "+remove_extension(name)).c_str());
     system((xcasroot()+"dvips.bat "+remove_extension(name)+" &").c_str());
 #else
+    int tmpresult;
     string s=remove_extension(name);
     string path=get_path(s);
     s=remove_path(s);
-    system(("cd "+path+" ; latex "+s+" ").c_str());
-    system(("cd "+path+" ; dvips "+s+" -o "+s+".ps && pstopnm -stdout "+s+" | pnmtopng > "+s+".png").c_str()); 
+    tmpresult=system(("cd "+path+" ; latex "+s+" ").c_str());
+    tmpresult=system(("cd "+path+" ; dvips "+s+" -o "+s+".ps && pstopnm -stdout "+s+" | pnmtopng > "+s+".png").c_str()); 
 #endif //    
   }
 
@@ -4282,12 +4284,12 @@
   int	widgetbuf::overflow(int c){
     put_buffer();
     
-    if (c != EOF)
+    if (c != EOF){
       if (pbase() == epptr())
 	put_char(c);
       else
 	sputc(c);
-    
+    }
     return 0;
   }
   
diff -ruN src/Tableur.cc src.new/Tableur.cc
--- src/Tableur.cc	2014-02-21 08:44:27.000000000 +0100
+++ src.new/Tableur.cc	2014-04-04 15:54:52.518738472 +0200
@@ -2665,7 +2665,7 @@
       question += gettext("row");
     else
       question += gettext("column");
-    const char * chptr=fl_input(question.c_str(),print_INT_(c).c_str());
+    const char * chptr=fl_input("%s",question.c_str(),print_INT_(c).c_str());
     if (!chptr)
       return -1;
     string colonne(chptr);
@@ -2721,7 +2721,7 @@
 	  question += gettext("row");
 	else
 	  question += gettext("column");
-	const char * chptr=fl_input(question.c_str(),tmp.c_str());
+	const char * chptr=fl_input("%s",question.c_str(),tmp.c_str());
 	if (!chptr){
 	  return;
 	}


parisse
Messages : 5731
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: -Werror=format-security

Message par parisse » lun. avr. 07, 2014 8:04 am

J'ai mis a jour la 1.1.1 avec ces changements, ainsi que le README et make check.

Répondre