Fix GCC 8 warning about sprintf overflow (#1192)

1008-fix
Jerzy B 2018-08-12 06:49:45 +01:00 committed by krzys_h
parent 5080cb46b1
commit f3b30625ee
1 changed files with 3 additions and 3 deletions

View File

@ -58,7 +58,7 @@ void CScreenIO::IOReadName()
CEdit* pe;
std::string resume;
char line[100];
char name[100];
std::string name;
time_t now;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
@ -81,10 +81,10 @@ void CScreenIO::IOReadName()
time(&now);
strftime(line, 99, "%y.%m.%d %H:%M", localtime(&now));
sprintf(name, "%s - %s %d", line, resume.c_str(), m_main->GetLevelRank());
name = StrUtils::Format("%s - %s %d", line, resume.c_str(), m_main->GetLevelRank());
pe->SetText(name);
pe->SetCursor(strlen(name), 0);
pe->SetCursor(name.length(), 0);
m_interface->SetFocus(pe);
}