diff --git a/src/app/qtsingleapplication/qtlocalpeer.cpp b/src/app/qtsingleapplication/qtlocalpeer.cpp index f3c4546b6..d8a1bce31 100644 --- a/src/app/qtsingleapplication/qtlocalpeer.cpp +++ b/src/app/qtsingleapplication/qtlocalpeer.cpp @@ -101,6 +101,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId) #endif server = new QLocalServer(this); + server->setSocketOptions(QLocalServer::UserAccessOption); QString lockName = QDir(QDir::tempPath()).absolutePath() + QLatin1Char('/') + socketName + QLatin1String("-lockfile"); @@ -191,6 +192,12 @@ void QtLocalPeer::receiveConnection() QByteArray uMsg; quint32 remaining; ds >> remaining; + if (remaining > 65535) { + // drop suspiciously large data + delete socket; + return; + } + uMsg.resize(remaining); int got = 0; char* uMsgBuf = uMsg.data(); diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 71694358d..0b6162f0b 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -4316,9 +4316,14 @@ void Session::handleTorrentDeleteFailedAlert(libt::torrent_delete_failed_alert * // so we remove the directory ourselves Utils::Fs::smartRemoveEmptyFolderTree(tmpRemovingTorrentData.savePathToRemove); - LogMsg(tr("'%1' was removed from the transfer list but the files couldn't be deleted. Error: %2", "'xxx.avi' was removed...") - .arg(tmpRemovingTorrentData.name, QString::fromLocal8Bit(p->error.message().c_str())) - , Log::CRITICAL); + if (p->error) { + LogMsg(tr("'%1' was removed from the transfer list but the files couldn't be deleted. Error: %2", "'xxx.avi' was removed...") + .arg(tmpRemovingTorrentData.name, QString::fromStdString(p->error.message())) + , Log::WARNING); + } + else { + LogMsg(tr("'%1' was removed from the transfer list.", "'xxx.avi' was removed...").arg(tmpRemovingTorrentData.name)); + } } void Session::handleMetadataReceivedAlert(libt::metadata_received_alert *p) diff --git a/src/base/bittorrent/torrenthandle.cpp b/src/base/bittorrent/torrenthandle.cpp index 13842b61d..5d4667649 100644 --- a/src/base/bittorrent/torrenthandle.cpp +++ b/src/base/bittorrent/torrenthandle.cpp @@ -1285,6 +1285,8 @@ void TorrentHandle::setSequentialDownload(bool b) m_nativeHandle.set_sequential_download(b); m_nativeStatus.sequential_download = b; // prevent return cached value } + + saveResumeData(); } void TorrentHandle::toggleSequentialDownload() @@ -1331,6 +1333,8 @@ void TorrentHandle::setFirstLastPiecePriorityImpl(const bool enabled, const QVec LogMsg(tr("Download first and last piece first: %1, torrent: '%2'") .arg((enabled ? tr("On") : tr("Off")), name())); + + saveResumeData(); } void TorrentHandle::toggleFirstLastPiecePriority()