gsdx: protect fscanf string read

Coverity:
CID 146816 (#1 of 1): Calling risky function (DC.STREAM_BUFFER)
dont_call: fscanf(FILE *, char const *, ...) assumes an arbitrarily large string, so callers must use correct precision specifiers or never use fscanf(FILE *, char const *, ...)
This commit is contained in:
Gregory Hainaut 2015-09-21 17:53:04 +02:00
parent 7bec15b99f
commit c4a3d57499
1 changed files with 3 additions and 3 deletions

View File

@ -243,13 +243,13 @@ void GSdxApp::BuildConfigurationMap(const char* lpFileName)
m_configuration_map["inifile"] = inifile_value; m_configuration_map["inifile"] = inifile_value;
// Load config from file // Load config from file
char value[255]; char value[256];
char key[255]; char key[256];
FILE* f = fopen(lpFileName, "r"); FILE* f = fopen(lpFileName, "r");
if (f == NULL) return; // FIXME print a nice message if (f == NULL) return; // FIXME print a nice message
while( fscanf(f, "%s = %s\n", key, value) != EOF ) { while( fscanf(f, "%255s = %255s\n", key, value) != EOF ) {
std::string key_s(key); std::string key_s(key);
std::string value_s(value); std::string value_s(value);
m_configuration_map[key_s] = value_s; m_configuration_map[key_s] = value_s;