aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tokenizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tokenizer.cpp')
-rw-r--r--src/tokenizer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp
index 7357fd35..8e0bc590 100644
--- a/src/tokenizer.cpp
+++ b/src/tokenizer.cpp
@@ -383,10 +383,11 @@ static size_t read_redirection_or_fd_pipe(const wchar_t *buff,
}
}
}
-
+
// Either way we should have ended on the redirection character itself like '>'.
+ // Don't allow an fd with a caret redirection - see #1873
wchar_t redirect_char = buff[idx++]; // note increment of idx
- if (redirect_char == L'>' || redirect_char == L'^') {
+ if (redirect_char == L'>' || (redirect_char == L'^' && idx == 1)) {
redirection_mode = TOK_REDIRECT_OUT;
if (buff[idx] == redirect_char) {
// Doubled up like ^^ or >>. That means append.