psi-plus / main

Main repository with patches and required resources
https://psi-plus.com/
GNU Lesser General Public License v2.1
69 stars 20 forks source link

error: format not a string literal and no format arguments [-Werror=format-security] #732

Closed rapgro closed 5 years ago

rapgro commented 5 years ago

In Fedora, this gcc warning is an error. Please fix in psi-new-history.patch with ideally, provide a format string for the variables printed in the qWarning.

/builddir/build/BUILD/psi-plus-snapshots-1.3.400/src/edbsqlite.cpp: In constructor 'EDBSqLite::EDBSqLite(PsiCon*)':
/builddir/build/BUILD/psi-plus-snapshots-1.3.400/src/edbsqlite.cpp:58:97: error: format not a string literal and no format arguments [-Werror=format-security]
         qWarning("EDBSqLite::EDBSqLite(): Can't open base.\n" + db.lastError().text().toLatin1());
                                                                                                 ^

/builddir/build/BUILD/psi-plus-snapshots-1.3.400/src/historyimp.cpp: In member function 'void HistoryImport::stop(int)':
/builddir/build/BUILD/psi-plus-snapshots-1.3.400/src/historyimp.cpp:149:105: error: format not a string literal and no format arguments [-Werror=format-security]
         qWarning(QString("Import is finished. Duration is %1 min. %2 sec.").arg(min).arg(sec).toLatin1());
                                                                                                         ^
/builddir/build/BUILD/psi-plus-snapshots-1.3.400/src/historyimp.cpp: In member function 'void HistoryImport::readFromFiles()':
/builddir/build/BUILD/psi-plus-snapshots-1.3.400/src/historyimp.cpp:191:91: error: format not a string literal and no format arguments [-Werror=format-security]
         qWarning(QString("Importing %1").arg(JIDUtil::toString(item.jid, true)).toLatin1());
                                                                                           ^
tehnick commented 5 years ago

Fixed in https://github.com/psi-plus/main/commit/d591669bc0e51ae7b96e3f2966289b3c4d09fd63

tehnick commented 5 years ago

@liuch Do not forget to sync changes.