diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-05-31 05:50:57 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-05-31 05:52:53 +0800 |
commit | 2de12e9bd7fe72eb4656a3c0f689caf6ce971451 (patch) | |
tree | a64ec7e199444fa8138698c832775a9ebeaf71c0 /src/nvim/strings.c | |
parent | df2c3b204b9622687d0cd7dd59cbd3f89d9383ce (diff) | |
download | rneovim-2de12e9bd7fe72eb4656a3c0f689caf6ce971451.tar.gz rneovim-2de12e9bd7fe72eb4656a3c0f689caf6ce971451.tar.bz2 rneovim-2de12e9bd7fe72eb4656a3c0f689caf6ce971451.zip |
vim-patch:9.1.0451: No test for escaping '<' with shellescape()
Problem: No test for escaping '<' with shellescape()
Solution: Add a test. Use memcpy() in code to make it easier to
understand. Fix a typo (zeertzjq).
closes: vim/vim#14876
https://github.com/vim/vim/commit/88c8c547d5fc380e5685c2b01ec564ccdf9b259a
Diffstat (limited to 'src/nvim/strings.c')
-rw-r--r-- | src/nvim/strings.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 485551da6e..8fef4ba7fd 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -266,11 +266,11 @@ char *vim_strsave_shellescape(const char *string, bool do_special, bool do_newli *d++ = *p++; continue; } - if (do_special && find_cmdline_var(p, &l) >= 0 && l > 0) { + if (do_special && find_cmdline_var(p, &l) >= 0) { *d++ = '\\'; // insert backslash - do { // copy the var - *d++ = *p++; - } while (--l > 0); + memcpy(d, p, l); // copy the var + d += l; + p += l; continue; } if (*p == '\\' && fish_like) { |