From 76efcc616b8182053f8679617cdb874b538b45b5 Mon Sep 17 00:00:00 2001 From: def Date: Sun, 22 May 2022 12:05:36 +0200 Subject: [PATCH] Fix 0 byte malloc in register.cpp (fixes #5187) --- src/engine/shared/http.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/engine/shared/http.h b/src/engine/shared/http.h index 931fde924..5cc866c2f 100644 --- a/src/engine/shared/http.h +++ b/src/engine/shared/http.h @@ -1,6 +1,7 @@ #ifndef ENGINE_SHARED_HTTP_H #define ENGINE_SHARED_HTTP_H +#include #include #include @@ -105,7 +106,7 @@ public: { m_Type = REQUEST::POST; m_BodyLength = DataLength; - m_pBody = (unsigned char *)malloc(DataLength); + m_pBody = (unsigned char *)malloc(std::max((size_t)1, DataLength)); mem_copy(m_pBody, pData, DataLength); } void PostJson(const char *pJson)