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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
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 );
 			}
 		}
-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux