summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-06 18:15:45 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-06 18:15:45 +0200
commit1c864093f93b0066de25d6c0ddf03a6bc6b1c870 (patch)
treed347a56a3addc4016581a4f4b1c5a465d470d48d
parent4535654246936de13eafd4e049b0a1991521fba4 (diff)
downloadvim-git-1c864093f93b0066de25d6c0ddf03a6bc6b1c870.tar.gz
patch 8.0.0883: invalid memory access with nonsensical scriptv8.0.0883
Problem: Invalid memory access with nonsensical script. Solution: Check "dstlen" being positive. (Dominique Pelle)
-rw-r--r--src/misc1.c15
-rw-r--r--src/version.c2
2 files changed, 12 insertions, 5 deletions
diff --git a/src/misc1.c b/src/misc1.c
index 4e51bed25..5f8b092c0 100644
--- 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 (dstlen > 0)
+ {
+ *dst++ = *src++;
+ --dstlen;
- if (startstr != NULL && src - startstr_len >= srcp
- && STRNCMP(src - startstr_len, startstr, startstr_len) == 0)
- at_start = TRUE;
+ 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
index 8c2b03296..e6bcfb5dd 100644
--- 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,