1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +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 int jsLen = js.length();
const char* rawJS = js.str(); const char* rawJS = js.str();
int strLen = jsLen * 12 * jsCS->mbmaxlen / jsCS->mbminlen; 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, if ((strLen = json_escape(retCS, (const uchar*)rawJS, (const uchar*)rawJS + jsLen, jsCS, (uchar*)buf,
(uchar*)buf + strLen)) >= 0) (uchar*)buf + strLen)) >= 0)
{ {