Skip to content
Myr

fzf-tmux: validate attached layout size value

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Attached option form (e.g. -l50) captured size via ${arg:2} with no validation, unlike the separate-argument form. For -l/-u the value reached $((...)) arithmetic, where a[$(cmd)] runs cmd during option parsing, before any tmux check. Same value was also expanded unquoted into `tmux popup ... $opt`, allowing tmux flag injection. Apply the separate-form regex to the attached form too. Rejects the array-subscript payload and space-bearing geometry values that enabled flag injection.

authored by Junegunn Choi · committed by Junegunn Choi · parent d8aeec3 · Browse files · 2 files+3 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Reported-by: sb24CK (https://github.com/sb24CK)

Diff stats

2 files+3 added−0 removed

  • other:+3 added−0 removed

2 files+3 added−0 removed

modified:bin/fzf-tmux+1 added
76 unmodified lines
77 fi78 fi79 if [[ ${#arg} -gt 2 ]]; then80 size="${arg:2}"81 [[ $size =~ ^[0-9%,]+$ || $size =~ ^[A-Z]$ ]] || continue82 else83 if [[ $1 =~ ^[0-9%,]+$ ]] || [[ $1 =~ ^[A-Z]$ ]]; then84 size="$1"85 shift
172 unmodified lines
modified:CHANGELOG.md+2 added
9 unmodified lines
10 - With `--id-nth`, the event is not triggered if the focus moves directly from an item to another item with the same key11 - A `focus` binding that runs `reload` now triggers itself again after each reload, unless `--id-nth` is set and the key does not change12- Fixed `--popup` unzooming the window when opened over a zoomed pane on tmux 3.8 or above (#4927, junegunn/fzf.vim#1625)13 - On tmux 3.7, the window is still unzoomed, as tmux 3.7b crashes when a floating pane is created over a zoomed window14- Security fixes15 - fzf-tmux no longer evaluates an attached layout size (e.g. `-l50`) via bash arithmetic, which could run commands or inject tmux flags (GHSA-w6x2-f5m4-xw82)16170.74.418------19- Fixed an escape sequence split across reads being parsed as a fragment, which leaked the rest into the query (#4899)
3451 unmodified lines