summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-08-13 16:51:26 +0200
committerBram Moolenaar <Bram@vim.org>2010-08-13 16:51:26 +0200
commit35a3423c6ae785bf739319e1ec416b2de1462a8c (patch)
treee3349f94a29f56a357978df3bf0ac8a3785a1e4d /src
parent4a474d36d7c5f40ce326d40d09549e86a7873a98 (diff)
downloadvim-git-35a3423c6ae785bf739319e1ec416b2de1462a8c.tar.gz
Fix illegal memory access when using expressions in the command line.
Diffstat (limited to 'src')
-rw-r--r--src/ex_getln.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index d2925535e..1cf678543 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -2527,7 +2527,10 @@ realloc_cmdbuff(len)
ccline.cmdbuff = p; /* keep the old one */
return FAIL;
}
- mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1);
+ /* There isn't always a NUL after the command, but it may need to be
+ * there, thus copy up to the NUL and add a NUL. */
+ mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen);
+ ccline.cmdbuff[ccline.cmdlen] = NUL;
vim_free(p);
if (ccline.xpc != NULL