summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-06-11 15:31:47 +0200
committerBram Moolenaar <Bram@vim.org>2016-06-11 15:31:47 +0200
commit62f8b4e18014b259bcde4a2845c602b0a44a3714 (patch)
tree76fc113d90ca646be2c912fca8e4128ca542a822 /src/ex_cmds.c
parent012270936c3c7df3bba45ad2b48938c23a2fd43a (diff)
patch 7.4.1918v7.4.1918
Problem: Not enough testing for parsing viminfo lines. Solution: Add test with viminfo lines in bad syntax. Fix memory leak.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 37e8e4c33c..63af5eb54b 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -2589,13 +2589,18 @@ barline_parse(vir_T *virp, char_u *text, bval_T *values)
++p;
len = getdigits(&p);
buf = alloc((int)(len + 1));
+ if (buf == NULL)
+ return count;
p = buf;
for (todo = len; todo > 0; todo -= n)
{
if (viminfo_readline(virp) || virp->vir_line[0] != '|'
|| virp->vir_line[1] != '<')
+ {
/* file was truncated or garbled */
- return 0;
+ vim_free(buf);
+ return count;
+ }
/* Get length of text, excluding |< and NL chars. */
n = STRLEN(virp->vir_line);
while (n > 0 && (virp->vir_line[n - 1] == NL
@@ -2623,7 +2628,7 @@ barline_parse(vir_T *virp, char_u *text, bval_T *values)
if (viminfo_readline(virp) || virp->vir_line[0] != '|'
|| virp->vir_line[1] != '<')
/* file was truncated or garbled */
- return 0;
+ return count;
p = virp->vir_line + 2;
}
}