0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00

In merge.hpp, detect multiline breakout attempt.

This commit is contained in:
James Yonan 2015-09-18 21:25:40 -07:00
parent d3d45937dc
commit ba91532554
2 changed files with 12 additions and 3 deletions

View File

@ -1230,8 +1230,8 @@ namespace openvpn {
str = str.substr(1, n-2);
}
// detect multiline breakout attempt
static void detect_multiline_breakout(const std::string& opt, const std::string& tag)
// detect multiline breakout attempt (return true)
static bool detect_multiline_breakout_nothrow(const std::string& opt, const std::string& tag)
{
std::string line;
for (auto &c : opt)
@ -1242,9 +1242,17 @@ namespace openvpn {
{
line += c;
if (is_close_tag(line, tag))
throw option_error("multiline breakout detected");
return true;
}
}
return false;
}
// detect multiline breakout attempt
static void detect_multiline_breakout(const std::string& opt, const std::string& tag)
{
if (detect_multiline_breakout_nothrow(opt, tag))
throw option_error("multiline breakout detected");
}
private:

View File

@ -306,6 +306,7 @@ namespace openvpn {
error_ = fn + ": file too large";
return;
}
OptionList::detect_multiline_breakout(file_content, opt.ref(0));
}
catch (const std::exception& e)
{