diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-05-15 08:45:13 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-05-15 08:45:13 +0200 |
commit | 253f9128779f315ea670f9b4a17446b7b4c74927 (patch) | |
tree | 39b5de82be5caa092302843d845e9ada0a966e12 | |
parent | 4475b623960671898dac6a72b13a8d140402afa6 (diff) | |
download | vim-git-253f9128779f315ea670f9b4a17446b7b4c74927.tar.gz |
patch 8.0.0597: off-by-one error in size computationv8.0.0597
Problem: Off-by-one error in buffer size computation.
Solution: Use ">=" instead of ">". (Lemonboy, closes #1694)
-rw-r--r-- | src/quickfix.c | 6 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/quickfix.c b/src/quickfix.c index 7b07f9358..9626cfa43 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -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, diff --git a/src/version.c b/src/version.c index f31a946dc..dd39fcdac 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 597, +/**/ 596, /**/ 595, |