mirror of
https://github.com/vim/vim.git
synced 2025-08-24 19:45:50 -04:00
patch 9.1.1680: MS-Windows: possible buffer-under run in if_cscope
Problem: MS-Windows: possible buffer-under run in if_cscope cs_pathcomponents() (Murali Aniruddhan) Solution: Fix the loop and do not decrement the pointer twice. closes: #18091 Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
ba9551d131
commit
191d77872d
@ -1940,12 +1940,18 @@ cs_pathcomponents(char *path)
|
|||||||
|
|
||||||
s = path + strlen(path) - 1;
|
s = path + strlen(path) - 1;
|
||||||
for (i = 0; i < p_cspc; ++i)
|
for (i = 0; i < p_cspc; ++i)
|
||||||
while (s > path && *--s != '/'
|
{
|
||||||
|
while (s > path)
|
||||||
|
{
|
||||||
|
s--;
|
||||||
|
if (*s == '/'
|
||||||
#ifdef MSWIN
|
#ifdef MSWIN
|
||||||
&& *--s != '\\'
|
|| *s == '\\'
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ((s > path && *s == '/')
|
if ((s > path && *s == '/')
|
||||||
#ifdef MSWIN
|
#ifdef MSWIN
|
||||||
|| (s > path && *s == '\\')
|
|| (s > path && *s == '\\')
|
||||||
|
@ -724,6 +724,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 */
|
||||||
|
/**/
|
||||||
|
1680,
|
||||||
/**/
|
/**/
|
||||||
1679,
|
1679,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user