aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-12-19 10:48:31 -0500
committerJames McCoy <jamessan@jamessan.com>2017-12-19 14:07:24 -0500
commitcdd86f42cf93135d1c4dddcc2ba13b9798034350 (patch)
tree50c5842ecb0b4fc00b455b487822b45d94b57466
parent6fcadab3ce16ff29be53176f8658e61819691df1 (diff)
downloadrneovim-cdd86f42cf93135d1c4dddcc2ba13b9798034350.tar.gz
rneovim-cdd86f42cf93135d1c4dddcc2ba13b9798034350.tar.bz2
rneovim-cdd86f42cf93135d1c4dddcc2ba13b9798034350.zip
vim-patch:8.0.0597: off-by-one error in size computation
Problem: Off-by-one error in buffer size computation. Solution: Use ">=" instead of ">". (Lemonboy, closes vim/vim#1694) https://github.com/vim/vim/commit/253f9128779f315ea670f9b4a17446b7b4c74927
-rw-r--r--src/nvim/quickfix.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index df735e32a9..3608a41a6e 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -801,7 +801,7 @@ restofline:
fields->type = *regmatch.startp[i];
}
if (fmt_ptr->flags == '+' && !qi->qf_multiscan) { // %+
- if (linelen > fields->errmsglen) {
+ if (linelen >= fields->errmsglen) {
// linelen + null terminator
fields->errmsg = xrealloc(fields->errmsg, linelen + 1);
fields->errmsglen = linelen + 1;
@@ -812,7 +812,7 @@ restofline:
continue;
}
len = (size_t)(regmatch.endp[i] - regmatch.startp[i]);
- if (len > fields->errmsglen) {
+ if (len >= fields->errmsglen) {
// len + null terminator
fields->errmsg = xrealloc(fields->errmsg, len + 1);
fields->errmsglen = len + 1;
@@ -889,7 +889,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
fields->errmsg = xrealloc(fields->errmsg, linelen + 1);
fields->errmsglen = linelen + 1;