aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r--src/nvim/ex_cmds2.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 2821074b0d..0a2802397d 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -2719,16 +2719,10 @@ static char_u *get_str_line(int c, void *cookie, int indent, bool do_concat)
while (!(p->buf[i] == '\n' || p->buf[i] == '\0')) {
i++;
}
- char buf[2046];
- char *dst;
- dst = xstpncpy(buf, (char *)p->buf + p->offset, i - p->offset);
- if ((uint32_t)(dst - buf) != i - p->offset) {
- smsg(_(":source error parsing command %s"), p->buf);
- return NULL;
- }
- buf[i - p->offset] = '\0';
+ size_t line_length = i - p->offset;
+ char_u *buf = xmemdupz(p->buf + p->offset, line_length);
p->offset = i + 1;
- return (char_u *)xstrdup(buf);
+ return buf;
}
static int source_using_linegetter(void *cookie,