diff options
author | nicm <nicm> | 2019-05-28 18:30:30 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2019-05-28 21:04:41 +0100 |
commit | 7eeb479705e9d30612b3b7bc08486858a857977a (patch) | |
tree | 505f63f407a05946f0d2108b4af97c24429fffc3 | |
parent | 8d137233a96c86d311f7f03c3322177a5e54d3fa (diff) |
Do not read past the end of the argument string if it is empty.
-rw-r--r-- | arguments.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arguments.c b/arguments.c index 829a5ef3..38e50829 100644 --- a/arguments.c +++ b/arguments.c @@ -210,6 +210,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); |