From 481604d165ee1ecaa3fe8490faa358f78ac2db65 Mon Sep 17 00:00:00 2001 From: Joshua T Corbin Date: Thu, 8 Jan 2009 18:52:55 -0500 Subject: [PATCH] Basic checks on path in SslServer::setCertificate. --- src/core/sslserver.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/sslserver.cpp b/src/core/sslserver.cpp index 570957da..53660f8b 100644 --- a/src/core/sslserver.cpp +++ b/src/core/sslserver.cpp @@ -62,7 +62,16 @@ void SslServer::incomingConnection(int socketDescriptor) { bool SslServer::setCertificate(const QString &path) { _certIsValid = false; + if (path.isNull()) { + return false; + } + QFile certFile(path); + if (! certFile.exists()) { + qWarning() << "SslServer: Certificate file" << qPrintable(path) << "does not exist"; + return false; + } + certFile.open(QIODevice::ReadOnly); _cert = QSslCertificate(&certFile); certFile.close(); -- 2.20.1