diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-05-30 19:27:25 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-05-30 19:27:25 +0200 |
commit | 88c8c547d5fc380e5685c2b01ec564ccdf9b259a (patch) | |
tree | 4a0dfe9ddf254048b5b61a22e1f50306c808ef59 /src/strings.c | |
parent | 32a5faa6d7592795c6ec77e44dc0357b92b8a681 (diff) |
patch 9.1.0451: No test for escaping '<' with shellescape()v9.1.0451
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: #14876
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/strings.c')
-rw-r--r-- | src/strings.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/strings.c b/src/strings.c index 9b66ee0e4a..6b2ff0a011 100644 --- a/src/strings.c +++ b/src/strings.c @@ -269,12 +269,12 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline) *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) |