diff --git a/src/command_ip.cc b/src/command_ip.cc index 6988a37c..1089589c 100644 --- a/src/command_ip.cc +++ b/src/command_ip.cc @@ -319,6 +319,11 @@ apply_ipv4_filter_load(const torrent::Object::list_type& args) { ipv4_filter_parse(buffer, value); } + if (file.fail() && !file.eof()) { + lineNumber++; + throw torrent::input_error("Exceeded max line length."); + } + } catch (torrent::input_error& e) { snprintf(buffer, 2048, "Error in ip filter file: %s:%u: %s", filename.c_str(), lineNumber, e.what()); diff --git a/src/rpc/parse_commands.cc b/src/rpc/parse_commands.cc index 34cb4c9c..06c74f7c 100644 --- a/src/rpc/parse_commands.cc +++ b/src/rpc/parse_commands.cc @@ -181,6 +181,11 @@ parse_command_file(const std::string& path) { getCount = 0; } + if (file.fail() && !file.eof()) { + lineNumber++; + throw torrent::input_error("Exceeded max line length."); + } + } catch (torrent::input_error& e) { snprintf(buffer, 2048, "Error in option file: %s:%u: %s", path.c_str(), lineNumber, e.what());