implement limits on command substitution output

This makes command substitutions impose the same limit on the amount
of data they accept as the `read` builtin. It does not limit output of
external commands or builtins in other contexts.

Fixes #3822
This commit is contained in:
Kurtis Rader
2017-07-26 20:17:04 -07:00
parent 7e36053ed9
commit 4197420f39
15 changed files with 257 additions and 95 deletions

View File

@@ -388,7 +388,7 @@ parse_execution_result_t parse_execution_context_t::run_function_statement(
const wcstring contents_str =
wcstring(this->src, contents_start, contents_end - contents_start);
int definition_line_offset = this->line_offset_of_character_at_offset(contents_start);
io_streams_t streams;
io_streams_t streams(0); // no limit on the amount of output from builtin_function()
int err =
builtin_function(*parser, streams, argument_list, contents_str, definition_line_offset);
proc_set_last_status(err);