mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-29 08:30:04 +00:00
Fixed to safely sscanf.
This commit is contained in:
parent
9ec4012209
commit
03996c45a8
@ -1114,13 +1114,19 @@ bool CAY8910::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, std::string& suffix)
|
||||
if (!bFound)
|
||||
break; // done
|
||||
|
||||
int _tstates = 0;
|
||||
int _ofs = 0;
|
||||
unsigned int _reg = 0;
|
||||
unsigned int _val = 0;
|
||||
if(4 != sscanf_s(value.c_str(), SS_YAML_VALUE_CHANGE_FORMAT,
|
||||
&ay_change[ay_change_count].tstates,
|
||||
&ay_change[ay_change_count].ofs,
|
||||
&ay_change[ay_change_count].reg,
|
||||
&ay_change[ay_change_count].val))
|
||||
&_tstates, &_ofs, &_reg, &_val))
|
||||
throw std::string("Card: AY8910: Failed to scanf change list");
|
||||
|
||||
ay_change[ay_change_count].tstates = _tstates;
|
||||
ay_change[ay_change_count].ofs = _ofs;
|
||||
ay_change[ay_change_count].reg = _reg;
|
||||
ay_change[ay_change_count].val = _val;
|
||||
|
||||
ay_change_count++;
|
||||
if (ay_change_count > AY_CHANGE_MAX)
|
||||
throw std::string("Card: AY8910: Too many changes");
|
||||
|
Loading…
Reference in New Issue
Block a user