From 7eeb479705e9d30612b3b7bc08486858a857977a Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 28 May 2019 18:30:30 +0000 Subject: Do not read past the end of the argument string if it is empty. --- arguments.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- cgit v1.2.3