Make room for the terminatig '\0' and prevent a potential buffer overflow.
This commit is contained in:
parent
cd0c447b43
commit
378a4ba0f7
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue