Skip to content

Commit 1c86409

Browse files
committed
patch 8.0.0883: invalid memory access with nonsensical script
Problem: Invalid memory access with nonsensical script. Solution: Check "dstlen" being positive. (Dominique Pelle)
1 parent 4535654 commit 1c86409

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/misc1.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4180,13 +4180,18 @@ expand_env_esc(
41804180
}
41814181
else if ((src[0] == ' ' || src[0] == ',') && !one)
41824182
at_start = TRUE;
4183-
*dst++ = *src++;
4184-
--dstlen;
4183+
if (dstlen > 0)
4184+
{
4185+
*dst++ = *src++;
4186+
--dstlen;
41854187

4186-
if (startstr != NULL && src - startstr_len >= srcp
4187-
&& STRNCMP(src - startstr_len, startstr, startstr_len) == 0)
4188-
at_start = TRUE;
4188+
if (startstr != NULL && src - startstr_len >= srcp
4189+
&& STRNCMP(src - startstr_len, startstr,
4190+
startstr_len) == 0)
4191+
at_start = TRUE;
4192+
}
41894193
}
4194+
41904195
}
41914196
*dst = NUL;
41924197
}

src/version.c

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

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
883,
772774
/**/
773775
882,
774776
/**/

0 commit comments

Comments
 (0)