Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fix(dirhistory): fix unsafe eval bug in back and forward widgets
The plugin unsafely processes directory paths in pop_past and pop_future. This commit fixes that.
- Loading branch information
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,14 +19,14 @@ export DIRHISTORY_SIZE=30 | |
| # Returns the element if the array was not empty, | ||
| # otherwise returns empty string. | ||
| function pop_past() { | ||
| eval "$1='$dirhistory_past[$#dirhistory_past]'" | ||
| eval "$1=${(q)dirhistory_past[$#dirhistory_past]}" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mcornella
Author
Member
|
||
| if [[ $#dirhistory_past -gt 0 ]]; then | ||
| dirhistory_past[$#dirhistory_past]=() | ||
| fi | ||
| } | ||
|
|
||
| function pop_future() { | ||
| eval "$1='$dirhistory_future[$#dirhistory_future]'" | ||
| eval "$1=${(q)dirhistory_future[$#dirhistory_future]}" | ||
| if [[ $#dirhistory_future -gt 0 ]]; then | ||
| dirhistory_future[$#dirhistory_future]=() | ||
| fi | ||
|
|
||
I've never seen this syntax before. What does
(q)do here? :-)