From 993e7be707e04992f3366cdf8b09953e29b10f81 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Thu, 31 Aug 2023 18:52:52 +0200 Subject: [PATCH] Fix: [Script] GSAdmin.Send() could generate invalid JSON (#11250) --- src/script/api/script_admin.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/script/api/script_admin.cpp b/src/script/api/script_admin.cpp index 42615d2aed..9f55e1b958 100644 --- a/src/script/api/script_admin.cpp +++ b/src/script/api/script_admin.cpp @@ -129,7 +129,10 @@ } std::string json; - ScriptAdmin::MakeJSON(vm, -1, SQUIRREL_MAX_DEPTH, json); + if (!ScriptAdmin::MakeJSON(vm, -1, SQUIRREL_MAX_DEPTH, json)) { + sq_pushinteger(vm, 0); + return 1; + } if (json.length() > NETWORK_GAMESCRIPT_JSON_LENGTH) { ScriptLog::Error("You are trying to send a table that is too large to the AdminPort. No data sent.");