Skip to content

Commit 253f912

Browse files
committed
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)
1 parent 4475b62 commit 253f912

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/quickfix.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ qf_parse_line(
919919
}
920920
if (fmt_ptr->flags == '+' && !qi->qf_multiscan) /* %+ */
921921
{
922-
if (linelen > fields->errmsglen)
922+
if (linelen >= fields->errmsglen)
923923
{
924924
/* linelen + null terminator */
925925
if ((fields->errmsg = vim_realloc(fields->errmsg,
@@ -934,7 +934,7 @@ qf_parse_line(
934934
if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
935935
continue;
936936
len = (int)(regmatch.endp[i] - regmatch.startp[i]);
937-
if (len > fields->errmsglen)
937+
if (len >= fields->errmsglen)
938938
{
939939
/* len + null terminator */
940940
if ((fields->errmsg = vim_realloc(fields->errmsg, len + 1))
@@ -1017,7 +1017,7 @@ qf_parse_line(
10171017
fields->namebuf[0] = NUL; /* no match found, remove file name */
10181018
fields->lnum = 0; /* don't jump to this line */
10191019
fields->valid = FALSE;
1020-
if (linelen > fields->errmsglen)
1020+
if (linelen >= fields->errmsglen)
10211021
{
10221022
/* linelen + null terminator */
10231023
if ((fields->errmsg = vim_realloc(fields->errmsg,

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
597,
767769
/**/
768770
596,
769771
/**/

0 commit comments

Comments
 (0)