mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
Limit amount of JSON dumped in case of error. (#2081)
This commit is contained in:
parent
58d9e52662
commit
b173d05865
@ -445,7 +445,14 @@ QJsonDocument CutterCore::parseJson(const char *res, const char *cmd)
|
||||
} else {
|
||||
eprintf("Failed to parse JSON: %s\n", jsonError.errorString().toLocal8Bit().constData());
|
||||
}
|
||||
eprintf("%s\n", json.constData());
|
||||
const int MAX_JSON_DUMP_SIZE = 8 * 1024;
|
||||
if (json.length() > MAX_JSON_DUMP_SIZE) {
|
||||
int originalSize = json.length();
|
||||
json.resize(MAX_JSON_DUMP_SIZE);
|
||||
eprintf("%d bytes total: %s ...\n", originalSize, json.constData());
|
||||
} else {
|
||||
eprintf("%s\n", json.constData());
|
||||
}
|
||||
}
|
||||
|
||||
return doc;
|
||||
|
Loading…
Reference in New Issue
Block a user