Fix null deref in strings loading without any file (#2955)

This commit is contained in:
Florian Märkl 2022-05-30 19:34:33 +02:00 committed by Anton Kochkov
parent 49cf6555a8
commit 712709200a

View File

@ -542,10 +542,7 @@ CutterJson CutterCore::cmdjTask(const QString &str)
RizinCmdTask task(str); RizinCmdTask task(str);
task.startTask(); task.startTask();
task.joinTask(); task.joinTask();
const char *res = task.getResultRaw(); return task.getResultJson();
char *copy = static_cast<char *>(rz_mem_alloc(strlen(res) + 1));
strcpy(copy, res);
return parseJson(copy, str);
} }
CutterJson CutterCore::parseJson(char *res, const char *cmd) CutterJson CutterCore::parseJson(char *res, const char *cmd)