Do not read past the end of the argument string if it is empty.

pull/1768/head
nicm 2019-05-28 18:30:30 +00:00
parent 299d4f3aaa
commit 4382538e4b
1 changed files with 2 additions and 0 deletions

View File

@ -211,6 +211,8 @@ args_escape(const char *s)
char *escaped, *result;
int flags;
if (*s == '\0')
return (xstrdup(s));
if ((strchr(quoted, s[0]) != NULL || s[0] == '~') && s[1] == '\0') {
xasprintf(&escaped, "\\%c", s[0]);
return (escaped);