Add a limit on the amount of data that can be passed back via DBus.
This commit is contained in:
parent
2fb6be4e8d
commit
252d55e467
|
@ -163,10 +163,15 @@ QVariantMap ExternalCommandHelper::CopyBlocks(const QString& sourceDevice, const
|
||||||
if (!blockSize) {
|
if (!blockSize) {
|
||||||
return QVariantMap();
|
return QVariantMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prevent some out of memory situations
|
||||||
constexpr qint64 MiB = 1 << 30;
|
constexpr qint64 MiB = 1 << 30;
|
||||||
if (blockSize > 100 * MiB) {
|
if (blockSize > 100 * MiB) {
|
||||||
return QVariantMap();
|
return QVariantMap();
|
||||||
}
|
}
|
||||||
|
if (targetDevice.isEmpty() && sourceLength > MiB) {
|
||||||
|
return QVariantMap();
|
||||||
|
}
|
||||||
|
|
||||||
QVariantMap reply;
|
QVariantMap reply;
|
||||||
reply[QStringLiteral("success")] = true;
|
reply[QStringLiteral("success")] = true;
|
||||||
|
|
Loading…
Reference in New Issue