Mercurial > vim
changeset 11426:3270f080bf0a v8.0.0597
patch 8.0.0597: off-by-one error in size computation
commit https://github.com/vim/vim/commit/253f9128779f315ea670f9b4a17446b7b4c74927
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 15 08:45:13 2017 +0200
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 https://github.com/vim/vim/issues/1694)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 15 May 2017 09:00:05 +0200 |
parents | 98d6836199ef |
children | 30e43349a78a |
files | src/quickfix.c src/version.c |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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,