Check the argument count before indexing config comment log args

A '# do:log.add_output=debug' line read args[1] past the end of the vector.
This commit is contained in:
xirvik
2026-09-19 01:06:31 +00:00
committed by Jari Sundell
parent d9439d7a95
commit 2086e8e780
4 changed files with 104 additions and 2 deletions
+6 -2
View File
@@ -86,9 +86,13 @@ config_comment_log(const std::string& command, const std::string& raw_args) {
pos = next_pos + 1;
}
if (command == "log.add_output")
if (command == "log.add_output") {
if (args.size() != 2)
throw torrent::input_error("Invalid number of arguments.");
log_add_group_output_str(args[0], args[1]);
else if (command == "log.open_file")
} else if (command == "log.open_file")
apply_log_open_str(0, args);
else if (command == "log.open_file.flush")
apply_log_open_str(log_flag_flush, args);