From 5b31a0aa4387b3783be20925f6ff253e9ea3cb71 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Fri, 8 Nov 2024 14:17:53 +0100 Subject: [PATCH] prevent heap overflow in cjson code Fixes #1991 --- src/m_json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_json.c b/src/m_json.c index 2c470ab2..aec12d91 100644 --- a/src/m_json.c +++ b/src/m_json.c @@ -49,7 +49,7 @@ json_t *JS_Open(const char *lump, const char *type, version_t maxversion) return NULL; } - json_t *json = cJSON_Parse(W_CacheLumpNum(lumpnum, PU_CACHE)); + json_t *json = cJSON_ParseWithLength(W_CacheLumpNum(lumpnum, PU_CACHE), W_LumpLength(lumpnum)); if (json == NULL) { const char *error_ptr = cJSON_GetErrorPtr();