IniFile: Prevent potential out-of-bounds access in ParseLine()
While current usages of ParseLine aren't problematic, this is still a public function that can be used for other purposes. Essentially makes the function handle potential external inputs a little nicer.
This commit is contained in:
parent
e2c769a9c5
commit
2ae370fc37
|
@ -20,7 +20,7 @@
|
|||
|
||||
void IniFile::ParseLine(const std::string& line, std::string* keyOut, std::string* valueOut)
|
||||
{
|
||||
if (line[0] == '#')
|
||||
if (line.empty() || line.front() == '#')
|
||||
return;
|
||||
|
||||
size_t firstEquals = line.find('=');
|
||||
|
|
Loading…
Reference in New Issue