Fix unsigned integer underflow in FString::_insert()

This commit is contained in:
Markus Gans 2017-04-15 19:32:43 +02:00
parent cb2e2e2045
commit 09d6c2879d
3 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,6 @@
2017-04-15 Markus Gans <guru.mail@muenster.de>
* Fix unsigned integer underflow in FString::_insert()
2017-04-14 Markus Gans <guru.mail@muenster.de>
* The Final Cut compiles also under OpenBSD
* The alt key now always generates an esc prefix

View File

@ -2267,7 +2267,7 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t* s)
if ( (length + len + 1) <= bufsize )
{
// output string <= bufsize
for (x = length; x > pos-1; x--) // shifting right side + '\0'
for (x = length; x+1 > pos; x--) // shifting right side + '\0'
string[x+len] = string[x];
for (x=0; x < len; x++) // insert string

View File

@ -2723,16 +2723,20 @@ char* FTerm::parseSecDA (char*& current_termtype)
case 19: // DEC VT340
case 24: // DEC VT320
if ( terminal_id_version == 20 )
#if defined(__NetBSD__) || defined(__OpenBSD__)
if ( terminal_id_version == 20 && isWSConsConsole() )
{
// NetBSD/OpenBSD workstation console
if ( std::strncmp(termtype, const_cast<char*>("wsvt25"), 6) == 0 )
netbsd_terminal = true;
else if ( std::strncmp(termtype, const_cast<char*>("vt220"), 5) == 0 )
{
openbsd_terminal = true;
new_termtype = const_cast<char*>("pccon");
}
}
break;
#endif
case 41: // DEC VT420
case 61: // DEC VT510
case 64: // DEC VT520