FTBFS if "-Werror=format-security" flag is used

Dhiru Kholia dhiru.kholia at gmail.com
Fri Dec 6 11:59:37 UTC 2013


On 12/04/13 at 07:10pm, Brendan Jones wrote:
> This is just a pain. Can someone explain to me why this is good?
>
> -------- Original Message --------
> Subject: [Bug 1037125] hydrogen FTBFS if "-Werror=format-security" flag is
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1037125

Hi Brendan,

Can you *really* pass a QByteArray object directly to printf (and similar
functions)?

I have attached a patch to fix this FTBFS bug. I can't say if the fix is
right (I don't know the code in question). Please give it a thought.

...

I had originally planned on submitting patches too but I got caught up
in a new project of mine.

--
Dhiru
-------------- next part --------------
diff --git a/libs/hydrogen/src/object.cpp b/libs/hydrogen/src/object.cpp
index a75be58..3e3815d 100644
--- a/libs/hydrogen/src/object.cpp
+++ b/libs/hydrogen/src/object.cpp
@@ -239,9 +239,9 @@ void* loggerThread_func( void* param )
 		QString tmpString;
 		for( it = last = queue.begin() ; it != queue.end() ; ++it ) {
 			last = it;
-			printf( it->toLocal8Bit() );
+			printf( "%s", it->toLocal8Bit().data() );
 			if( pLogFile ) {
-				fprintf( pLogFile, it->toLocal8Bit() );
+				fprintf( pLogFile, "%s", it->toLocal8Bit().data() );
 				fflush( pLogFile );
 			}
 		}


More information about the devel mailing list