Permalink
Browse files

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 #1694)
  • Loading branch information...
brammool committed May 15, 2017
1 parent 4475b62 commit 253f9128779f315ea670f9b4a17446b7b4c74927
Showing with 5 additions and 3 deletions.
  1. +3 −3 src/quickfix.c
  2. +2 −0 src/version.c
View
@@ -919,7 +919,7 @@ qf_parse_line(
}
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 @@ qf_parse_line(
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 @@ qf_parse_line(
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,
View
@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
597,
/**/
596,
/**/

0 comments on commit 253f912

Please sign in to comment.