From: ehofman Date: Fri, 28 Nov 2003 17:56:36 +0000 (+0000) Subject: Make room for the terminatig '\0' and prevent a potential buffer overflow. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=378a4ba0f725794bf430815296fac6eb87276c67;p=flightgear.git Make room for the terminatig '\0' and prevent a potential buffer overflow. --- diff --git a/src/GUI/AirportList.cxx b/src/GUI/AirportList.cxx index 2057e520f..73fbdd2aa 100644 --- a/src/GUI/AirportList.cxx +++ b/src/GUI/AirportList.cxx @@ -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;