# HG changeset patch # User Christian Brabandt # Date 1502039704 -7200 # Node ID 0496ea4c5c2e1e57fd1bc288f09a00fb08d380c0 # Parent 2b8cb306954fa6534840eae98387bafacfb5efb2 patch 8.0.0883: invalid memory access with nonsensical script commit https://github.com/vim/vim/commit/1c864093f93b0066de25d6c0ddf03a6bc6b1c870 Author: Bram Moolenaar Date: Sun Aug 6 18:15:45 2017 +0200 patch 8.0.0883: invalid memory access with nonsensical script Problem: Invalid memory access with nonsensical script. Solution: Check "dstlen" being positive. (Dominique Pelle) diff --git a/src/misc1.c b/src/misc1.c --- a/src/misc1.c +++ b/src/misc1.c @@ -4180,13 +4180,18 @@ expand_env_esc( } else if ((src[0] == ' ' || src[0] == ',') && !one) at_start = TRUE; - *dst++ = *src++; - --dstlen; - - if (startstr != NULL && src - startstr_len >= srcp - && STRNCMP(src - startstr_len, startstr, startstr_len) == 0) - at_start = TRUE; - } + if (dstlen > 0) + { + *dst++ = *src++; + --dstlen; + + if (startstr != NULL && src - startstr_len >= srcp + && STRNCMP(src - startstr_len, startstr, + startstr_len) == 0) + at_start = TRUE; + } + } + } *dst = NUL; } diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -770,6 +770,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 883, +/**/ 882, /**/ 881,