forked from qt-creator/qt-creator
Fixed signed int overflow in remotelinux plugin
Change-Id: Icf2a707a0195b1d197b7c965100a783f3e78f52a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Robert Loehning <robert.loehning@nokia.com>
This commit is contained in:
committed by
Oswald Buddenhagen
parent
ac6ca18ec0
commit
c3e7a9b830
@@ -91,6 +91,7 @@ void RemoteLinuxCheckForFreeDiskSpaceService::handleProcessFinished()
|
||||
QByteArray processOutput = d->processRunner->readAllStandardOutput();
|
||||
processOutput.chop(1); // newline
|
||||
quint64 freeSpace = processOutput.toULongLong(&isNumber);
|
||||
quint64 requiredSpaceInMegaBytes = d->requiredSpaceInBytes / (1024 * 1024);
|
||||
if (!isNumber) {
|
||||
emit errorMessage(tr("Unexpected output from remote process: '%1'.")
|
||||
.arg(QString::fromUtf8(processOutput)));
|
||||
@@ -98,15 +99,15 @@ void RemoteLinuxCheckForFreeDiskSpaceService::handleProcessFinished()
|
||||
return;
|
||||
}
|
||||
|
||||
freeSpace *= 1024;
|
||||
if (freeSpace < d->requiredSpaceInBytes) {
|
||||
emit errorMessage(tr("The remote file system has only %n bytes of free space, "
|
||||
"but %1 bytes are required.", 0, freeSpace).arg(d->requiredSpaceInBytes));
|
||||
freeSpace /= 1024; // convert kilobyte to megabyte
|
||||
if (freeSpace < requiredSpaceInMegaBytes) {
|
||||
emit errorMessage(tr("The remote file system has only %n megabytes of free space, "
|
||||
"but %1 megabytes are required.", 0, freeSpace).arg(requiredSpaceInMegaBytes));
|
||||
stopDeployment();
|
||||
return;
|
||||
}
|
||||
|
||||
emit progressMessage(tr("The remote file system has %n bytes of free space, going ahead.",
|
||||
emit progressMessage(tr("The remote file system has %n megabytes of free space, going ahead.",
|
||||
0, freeSpace));
|
||||
stopDeployment();
|
||||
}
|
||||
|
Reference in New Issue
Block a user