1
0
forked from aniani/vim

patch 8.0.0883: invalid memory access with nonsensical script

Problem:    Invalid memory access with nonsensical script.
Solution:   Check "dstlen" being positive. (Dominique Pelle)
This commit is contained in:
Bram Moolenaar
2017-08-06 18:15:45 +02:00
parent 4535654246
commit 1c864093f9
2 changed files with 12 additions and 5 deletions

View File

@@ -4180,13 +4180,18 @@ expand_env_esc(
} }
else if ((src[0] == ' ' || src[0] == ',') && !one) else if ((src[0] == ' ' || src[0] == ',') && !one)
at_start = TRUE; at_start = TRUE;
*dst++ = *src++; if (dstlen > 0)
--dstlen; {
*dst++ = *src++;
--dstlen;
if (startstr != NULL && src - startstr_len >= srcp if (startstr != NULL && src - startstr_len >= srcp
&& STRNCMP(src - startstr_len, startstr, startstr_len) == 0) && STRNCMP(src - startstr_len, startstr,
at_start = TRUE; startstr_len) == 0)
at_start = TRUE;
}
} }
} }
*dst = NUL; *dst = NUL;
} }

View File

@@ -769,6 +769,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
883,
/**/ /**/
882, 882,
/**/ /**/