[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kio-extras] smb: Avoid crash by not checking free space for smb://
From:       Kai Uwe Broulik <null () kde ! org>
Date:       2018-08-31 7:17:37
Message-ID: E1fvdgX-0004zQ-O1 () code ! kde ! org
[Download RAW message or body]

Git commit 000b1d910b71b491621c7cdbd934c277171c20bf by Kai Uwe Broulik.
Committed on 31/08/2018 at 07:17.
Pushed by broulik into branch 'master'.

Avoid crash by not checking free space for smb://

This isn't a real location but the overview of all found hosts.
smbc_opendir would succeed but then crash in smbc_fstatvfs

Differential Revision: https://phabricator.kde.org/D15142

M  +8    -0    smb/kio_smb_browse.cpp

https://commits.kde.org/kio-extras/000b1d910b71b491621c7cdbd934c277171c20bf

diff --git a/smb/kio_smb_browse.cpp b/smb/kio_smb_browse.cpp
index 9024b2b3..3f98b238 100644
--- a/smb/kio_smb_browse.cpp
+++ b/smb/kio_smb_browse.cpp
@@ -492,6 +492,14 @@ void SMBSlave::fileSystemFreeSpace(const QUrl& url)
 {
     qCDebug(KIO_SMB) << url;
 
+    // Avoid crashing in smbc_fstatvfs below when
+    // requesting free space for smb:// which doesn't
+    // make sense to do to begin with
+    if (url.host().isEmpty()) {
+        error(KIO::ERR_COULD_NOT_STAT, url.url());
+        return;
+    }
+
     SMBUrl smbcUrl = url;
     int handle = smbc_opendir(smbcUrl.toSmbcUrl());
     if (handle < 0) {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic