CGE2: Fix write overflow compiler warning

This commit is contained in:
Kaloyan Chehlarski 2023-10-28 12:53:17 +03:00
parent a9dac765fe
commit bc7613e1fb

View File

@ -112,12 +112,15 @@ char *VMenu::vmGather(Common::Array<Choice *> list) {
}
len += h;
_vmgt = new char[len];
*_vmgt = '\0';
for (uint i = 0; i < list.size(); i++) {
if (*_vmgt)
Common::strcat_s(_vmgt, len, "|");
Common::strcat_s(_vmgt, len, list[i]->_text);
++h;
if (len) {
*_vmgt = '\0';
for (uint i = 0; i < list.size(); i++) {
if (*_vmgt)
Common::strcat_s(_vmgt, len, "|");
Common::strcat_s(_vmgt, len, list[i]->_text);
++h;
}
}
return _vmgt;