Reject an over-long line instead of truncating

getline sets failbit, which both loops read as end of input.
This commit is contained in:
noctuum
2026-09-16 17:31:22 +05:00
committed by Jari Sundell
parent 5ebb7bd151
commit c1ce2febf0
2 changed files with 10 additions and 0 deletions
+5
View File
@@ -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());