1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

chore(memory): fix dynamic stack buffer overflow

This commit is contained in:
Leonid Fedorov
2025-05-20 20:08:28 +00:00
committed by Leonid Fedorov
parent b65a5a1ef9
commit 10c2ce0dd5

View File

@ -31,7 +31,7 @@ bool appendEscapedJS(string& ret, const CHARSET_INFO* retCS, const utils::NullSt
const int jsLen = js.length();
const char* rawJS = js.str();
int strLen = jsLen * 12 * jsCS->mbmaxlen / jsCS->mbminlen;
char* buf = (char*)alloca(strLen);
char* buf = (char*)alloca(strLen + 1);
if ((strLen = json_escape(retCS, (const uchar*)rawJS, (const uchar*)rawJS + jsLen, jsCS, (uchar*)buf,
(uchar*)buf + strLen)) >= 0)
{