[PATCH 3 of 3] Verify the binary directly without relying on settings (which might differ)

Wald Commits scm-commit at wald.intevation.org
Wed May 28 10:36:10 CEST 2014


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1401266165 0
# Node ID 778f74d0706f7b5b8beddecbe66c04947c615fbf
# Parent  26a18e3c3db4820968e8b6b2591f94643e4e87b7
Verify the binary directly without relying on settings (which might differ)

diff -r 26a18e3c3db4 -r 778f74d0706f ui/mainwindow.cpp
--- a/ui/mainwindow.cpp	Wed May 28 07:56:21 2014 +0000
+++ b/ui/mainwindow.cpp	Wed May 28 08:36:05 2014 +0000
@@ -233,8 +233,16 @@
 
 void MainWindow::installNewSW(const QString& fileName, const QDateTime& modDate) {
     QFileInfo instProcInfo = QFileInfo(fileName);
-    verifySWData();
     QString filePath = QDir::toNativeSeparators(instProcInfo.absoluteFilePath());
+
+    if (verify_binary(filePath.toUtf8().constData(),
+            filePath.toUtf8().size()) != VerifyValid) {
+        qDebug() << "Invalid software. Not installing";
+        return;
+      }
+    QFileInfo fi(QCoreApplication::applicationFilePath());
+    QDir installDir = fi.absoluteDir();
+
 #ifdef WIN32
     SHELLEXECUTEINFOW shExecInfo;
     memset (&shExecInfo, 0, sizeof(SHELLEXECUTEINFOW));


More information about the Trustbridge-commits mailing list