summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarc Cornellà <hello@mcornella.com>2021-11-09 15:05:53 +0100
committerMarc Cornellà <hello@mcornella.com>2021-11-11 22:44:28 +0100
commit06fc5fb12900d7ee5821a5f20b47be2c4b894ac0 (patch)
treee0f6369d76749535e9544e0d1ef8215a524d8bc5 /plugins
parent6cb41b70a6d04301fd50cd5862ecd705ba226c0e (diff)
downloadzsh-06fc5fb12900d7ee5821a5f20b47be2c4b894ac0.tar.gz
zsh-06fc5fb12900d7ee5821a5f20b47be2c4b894ac0.tar.bz2
zsh-06fc5fb12900d7ee5821a5f20b47be2c4b894ac0.zip
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.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/dirhistory/dirhistory.plugin.zsh4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh
index 971eb6540..e3f45ee99 100644
--- a/plugins/dirhistory/dirhistory.plugin.zsh
+++ b/plugins/dirhistory/dirhistory.plugin.zsh
@@ -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]}"
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