WINTERMUTE: Don't use unsafe strcat and strcpy

This commit is contained in:
Le Philousophe
2022-10-23 22:46:19 +02:00
committed by Eugene Sandulenko
parent 4bbe3d9286
commit 73c09b1d56
28 changed files with 176 additions and 204 deletions
@@ -75,19 +75,19 @@ SXArray::~SXArray() {
//////////////////////////////////////////////////////////////////////////
const char *SXArray::scToString() {
char dummy[32768];
strcpy(dummy, "");
dummy[0] = '\0';
char propName[20];
for (int i = 0; i < _length; i++) {
sprintf(propName, "%d", i);
ScValue *val = _values->getProp(propName);
if (val) {
if (strlen(dummy) + strlen(val->getString()) < 32768) {
strcat(dummy, val->getString());
Common::strcat_s(dummy, val->getString());
}
}
if (i < _length - 1 && strlen(dummy) + 1 < 32768) {
strcat(dummy, ",");
Common::strcat_s(dummy, ",");
}
}
_strRep = dummy;