]> granicus.if.org Git - vim/commitdiff
patch 8.0.0597: off-by-one error in size computation v8.0.0597
authorBram Moolenaar <Bram@vim.org>
Mon, 15 May 2017 06:45:13 +0000 (08:45 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 15 May 2017 06:45:13 +0000 (08:45 +0200)
Problem:    Off-by-one error in buffer size computation.
Solution:   Use ">=" instead of ">". (Lemonboy, closes #1694)

src/quickfix.c
src/version.c

index 7b07f9358a96a18c0d665e63c8ea7aa3f7d806d5..9626cfa43009249f5ec54e240986a798d785456d 100644 (file)
@@ -919,7 +919,7 @@ restofline:
            }
            if (fmt_ptr->flags == '+' && !qi->qf_multiscan)     /* %+ */
            {
-               if (linelen > fields->errmsglen)
+               if (linelen >= fields->errmsglen)
                {
                    /* linelen + null terminator */
                    if ((fields->errmsg = vim_realloc(fields->errmsg,
@@ -934,7 +934,7 @@ restofline:
                if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
                    continue;
                len = (int)(regmatch.endp[i] - regmatch.startp[i]);
-               if (len > fields->errmsglen)
+               if (len >= fields->errmsglen)
                {
                    /* len + null terminator */
                    if ((fields->errmsg = vim_realloc(fields->errmsg, len + 1))
@@ -1017,7 +1017,7 @@ restofline:
        fields->namebuf[0] = NUL;       /* no match found, remove file name */
        fields->lnum = 0;                       /* don't jump to this line */
        fields->valid = FALSE;
-       if (linelen > fields->errmsglen)
+       if (linelen >= fields->errmsglen)
        {
            /* linelen + null terminator */
            if ((fields->errmsg = vim_realloc(fields->errmsg,
index f31a946dc073c2d33666927b1892c3f6aa8006b7..dd39fcdac588a47c5d675d3ffafa5cea92c60580 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    597,
 /**/
     596,
 /**/