[Server] Make GetCellStateDescription's cstrDescription null-terminated

This commit is contained in:
David Cernat 2017-01-27 14:16:27 +02:00
parent 1c810ecad5
commit 9c3a37a790

View file

@ -27,7 +27,7 @@ const char *CellFunctions::GetCellStateDescription(unsigned short pid, unsigned
string cellDescription = player->cellStateChanges.cells.at(i).getDescription();
static vector<char> cstrDescription;
cstrDescription.reserve(cellDescription.size());
cstrDescription.reserve(cellDescription.size() + 1);
strncpy(&cstrDescription[0], cellDescription.c_str(), cstrDescription.capacity());
return &cstrDescription[0];