mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
updated for version 7.4.010
Problem: Crash with invalid argument to mkdir(). Solution: Check for empty string. (lcd47)
This commit is contained in:
25
src/eval.c
25
src/eval.c
@@ -14292,18 +14292,23 @@ f_mkdir(argvars, rettv)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
dir = get_tv_string_buf(&argvars[0], buf);
|
dir = get_tv_string_buf(&argvars[0], buf);
|
||||||
if (*gettail(dir) == NUL)
|
if (*dir == NUL)
|
||||||
/* remove trailing slashes */
|
rettv->vval.v_number = FAIL;
|
||||||
*gettail_sep(dir) = NUL;
|
else
|
||||||
|
|
||||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
|
||||||
{
|
{
|
||||||
if (argvars[2].v_type != VAR_UNKNOWN)
|
if (*gettail(dir) == NUL)
|
||||||
prot = get_tv_number_chk(&argvars[2], NULL);
|
/* remove trailing slashes */
|
||||||
if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
|
*gettail_sep(dir) = NUL;
|
||||||
mkdir_recurse(dir, prot);
|
|
||||||
|
if (argvars[1].v_type != VAR_UNKNOWN)
|
||||||
|
{
|
||||||
|
if (argvars[2].v_type != VAR_UNKNOWN)
|
||||||
|
prot = get_tv_number_chk(&argvars[2], NULL);
|
||||||
|
if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
|
||||||
|
mkdir_recurse(dir, prot);
|
||||||
|
}
|
||||||
|
rettv->vval.v_number = prot == -1 ? FAIL : vim_mkdir_emsg(dir, prot);
|
||||||
}
|
}
|
||||||
rettv->vval.v_number = prot == -1 ? FAIL : vim_mkdir_emsg(dir, prot);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -727,6 +727,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 */
|
||||||
|
/**/
|
||||||
|
10,
|
||||||
/**/
|
/**/
|
||||||
9,
|
9,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user