summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2011-03-24 10:34:43 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2011-03-24 11:00:23 (GMT)
commit76ea46579d0678ec7b1cc9306b82ef5fc7601493 (patch)
tree0e24bb863a88352e5445672d9a90c11d6c564243 /src
parent551ba5eb80bb8e4e522154f43abf864b8bf5146d (diff)
downloadQt-76ea46579d0678ec7b1cc9306b82ef5fc7601493.zip
Qt-76ea46579d0678ec7b1cc9306b82ef5fc7601493.tar.gz
Qt-76ea46579d0678ec7b1cc9306b82ef5fc7601493.tar.bz2
FTP: Only read as much as the buffer size the user provided
Task-number: QTBUG-18309 Reviewed-by: Peter Hartmann
Diffstat (limited to 'src')
-rw-r--r--src/network/access/qftp.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp
index ccc20e6..69e59d1 100644
--- a/src/network/access/qftp.cpp
+++ b/src/network/access/qftp.cpp
@@ -363,9 +363,9 @@ qint64 QFtpDTP::read(char *data, qint64 maxlen)
if (socket && socket->state() == QTcpSocket::ConnectedState) {
read = socket->read(data, maxlen);
} else {
- read = bytesFromSocket.size();
+ read = qMin(maxlen, qint64(bytesFromSocket.size()));
memcpy(data, bytesFromSocket.data(), read);
- bytesFromSocket.clear();
+ bytesFromSocket.remove(0, read);
}
bytesDone += read;