From 8d137233a96c86d311f7f03c3322177a5e54d3fa Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 28 May 2019 18:53:36 +0000 Subject: [PATCH 1/2] Redraw status line if size changes, GitHub issue 1762. Also fix length of target buffer when pasting into status line. --- status.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/status.c b/status.c index ce36cc3c..0f96f0d3 100644 --- a/status.c +++ b/status.c @@ -348,10 +348,8 @@ status_redraw(struct client *c) /* Resize the target screen. */ if (screen_size_x(&sl->screen) != width || screen_size_y(&sl->screen) != lines) { - if (screen_size_x(&sl->screen) != width) - force = 1; screen_resize(&sl->screen, width, lines, 0); - changed = 1; + changed = force = 1; } screen_write_start(&ctx, NULL, &sl->screen); @@ -865,7 +863,7 @@ status_prompt_paste(struct client *c) if ((pb = paste_get_top(NULL)) == NULL) return (0); bufdata = paste_buffer_data(pb, &bufsize); - ud = xreallocarray(NULL, bufsize, sizeof *ud); + ud = xreallocarray(NULL, bufsize + 1, sizeof *ud); udp = ud; for (i = 0; i != bufsize; /* nothing */) { more = utf8_open(udp, bufdata[i]); From 7eeb479705e9d30612b3b7bc08486858a857977a Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 28 May 2019 18:30:30 +0000 Subject: [PATCH 2/2] 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);