mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Do not read past the end of the argument string if it is empty.
This commit is contained in:
parent
299d4f3aaa
commit
4382538e4b
@ -211,6 +211,8 @@ args_escape(const char *s)
|
|||||||
char *escaped, *result;
|
char *escaped, *result;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
if (*s == '\0')
|
||||||
|
return (xstrdup(s));
|
||||||
if ((strchr(quoted, s[0]) != NULL || s[0] == '~') && s[1] == '\0') {
|
if ((strchr(quoted, s[0]) != NULL || s[0] == '~') && s[1] == '\0') {
|
||||||
xasprintf(&escaped, "\\%c", s[0]);
|
xasprintf(&escaped, "\\%c", s[0]);
|
||||||
return (escaped);
|
return (escaped);
|
||||||
|
Loading…
Reference in New Issue
Block a user