mirror of
https://github.com/neovim/neovim.git
synced 2026-04-22 07:15:34 +00:00
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)
253f912877
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user