Commit 233a9aad authored by Chen Bill's avatar Chen Bill Committed by GitHub

Refactor buffer sizes for name and message handling (#2825)

parent f7266022
......@@ -747,7 +747,7 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break;
}
case MSG_AI_NAME: {
char namebuf[128]{};
char namebuf[SIZE_AI_NAME]{};
wchar_t wname[20]{};
int name_len = buffer_read<uint16_t>(pbuf);
if (name_len + 1 <= (int)sizeof namebuf) {
......@@ -760,8 +760,8 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
break;
}
case MSG_SHOW_HINT: {
char msgbuf[1024]{};
wchar_t msg[1024]{};
char msgbuf[SIZE_HINT_MSG]{};
wchar_t msg[SIZE_HINT_MSG]{};
int msg_len = buffer_read<uint16_t>(pbuf);
if (msg_len + 1 <= (int)sizeof msgbuf) {
std::memcpy(msgbuf, pbuf, msg_len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment