1
0
Fork 0

Make room for the terminatig '\0' and prevent a potential buffer overflow.

This commit is contained in:
ehofman 2003-11-28 17:56:36 +00:00
parent cd0c447b43
commit 378a4ba0f7

View file

@ -21,7 +21,7 @@ AirportList::AirportList (int x, int y, int width, int height)
airport->id.c_str(),
airport->name.c_str());
int str_len = strlen(buf);
_content[i] = new char[(str_len > 1023) ? 1024 : str_len];
_content[i] = new char[(str_len > 1023) ? 1024 : str_len+1];
strncpy(_content[i], buf, 1023);
}
_content[_nAirports] = 0;