mirror of
https://github.com/tmux/tmux.git
synced 2024-11-18 02:18:53 +00:00
Do not read past the end of the argument string if it is empty.
This commit is contained in:
parent
8d137233a9
commit
7eeb479705
@ -210,6 +210,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