From 1c864093f93b0066de25d6c0ddf03a6bc6b1c870 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 6 Aug 2017 18:15:45 +0200 Subject: [PATCH] patch 8.0.0883: invalid memory access with nonsensical script Problem: Invalid memory access with nonsensical script. Solution: Check "dstlen" being positive. (Dominique Pelle) --- src/misc1.c | 15 ++++++++++----- src/version.c | 2 ++ 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 @@ -769,6 +769,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 883, /**/ 882, /**/ -- 2.50.1