std::scanf used now fields with width limit

This commit is contained in:
Markus Gans 2017-09-18 00:10:14 +02:00
parent 59e8dd65c4
commit 82f1b7e44c
3 changed files with 6 additions and 5 deletions

View File

@ -2,6 +2,7 @@
* FObject has received the iterator child access methods * FObject has received the iterator child access methods
begin() and end() begin() and end()
* All include files were moved to a separate directory * All include files were moved to a separate directory
* std::scanf used now fields with width limit
2017-09-15 Markus Gans <guru.mail@muenster.de> 2017-09-15 Markus Gans <guru.mail@muenster.de>
* Fix byte access in data type char_data * Fix byte access in data type char_data

View File

@ -497,7 +497,7 @@ void FApplication::processKeyboardEvent()
widget->focusFirstChild(); widget->focusFirstChild();
} }
// empty the buffer on timeout // Empty the buffer on timeout
if ( fifo_in_use && widget->isKeyTimeout(&time_keypressed, key_timeout) ) if ( fifo_in_use && widget->isKeyTimeout(&time_keypressed, key_timeout) )
{ {
fifo_offset = 0; fifo_offset = 0;

View File

@ -903,7 +903,7 @@ const FString* FTerm::getXTermFont()
{ {
char temp[150] = {}; char temp[150] = {};
if ( std::scanf("\033]50;%[^\n]s", temp) == 1 ) if ( std::scanf("\033]50;%148[^\n]s", temp) == 1 )
{ {
FString* xtermfont; FString* xtermfont;
std::size_t n = std::strlen(temp); std::size_t n = std::strlen(temp);
@ -952,7 +952,7 @@ const FString* FTerm::getXTermTitle()
{ {
char temp[512] = {}; char temp[512] = {};
if ( std::scanf("\033]l%[^\n]s", temp) == 1 ) if ( std::scanf("\033]l%509[^\n]s", temp) == 1 )
{ {
std::size_t n = std::strlen(temp); std::size_t n = std::strlen(temp);
@ -1009,7 +1009,7 @@ const FString FTerm::getXTermColorName (int color)
// read the terminal answer // read the terminal answer
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0) if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0)
{ {
if ( std::scanf("\033]4;%d;%[^\n]s", &color, temp) == 2 ) if ( std::scanf("\033]4;%10d;%509[^\n]s", &color, temp) == 2 )
{ {
std::size_t n = std::strlen(temp); std::size_t n = std::strlen(temp);
@ -1536,7 +1536,7 @@ const FString FTerm::getSecDA()
// read the answer // read the answer
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) == 1 ) if ( select (stdin_no + 1, &ifds, 0, 0, &tv) == 1 )
if ( std::scanf("\033[>%d;%d;%dc", &a, &b, &c) == 3 ) if ( std::scanf("\033[>%10d;%10d;%10dc", &a, &b, &c) == 3 )
sec_da_str.sprintf("\033[>%d;%d;%dc", a, b, c); sec_da_str.sprintf("\033[>%d;%d;%dc", a, b, c);
return sec_da_str; return sec_da_str;