From 2ae370fc371e14a3f4d7765cf361a0a911452471 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 22 May 2019 21:09:09 -0400 Subject: [PATCH] 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. --- Source/Core/Common/IniFile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index 43bbe7b50b..c0e07df483 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -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('=');