diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-08-30 16:00:08 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-08-30 16:00:08 +0200 |
commit | 195ef0ccb26b3edfd0f31b30d80108290b2e9b1d (patch) | |
tree | 708da4909978374512c4cd4d8a788fdc63a96deb /src | |
parent | cf81aefd9c33e2619965ce9854c79105dc7b8bea (diff) | |
download | vim-195ef0ccb26b3edfd0f31b30d80108290b2e9b1d.zip |
updated for version 7.4.010
Problem: Crash with invalid argument to mkdir().
Solution: Check for empty string. (lcd47)
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 25 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/eval.c b/src/eval.c index 58317d29b..73844800c 100644 --- a/src/eval.c +++ b/src/eval.c @@ -14292,18 +14292,23 @@ f_mkdir(argvars, rettv) return; dir = get_tv_string_buf(&argvars[0], buf); - if (*gettail(dir) == NUL) - /* remove trailing slashes */ - *gettail_sep(dir) = NUL; - - if (argvars[1].v_type != VAR_UNKNOWN) + if (*dir == NUL) + rettv->vval.v_number = FAIL; + else { - 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); + if (*gettail(dir) == NUL) + /* remove trailing slashes */ + *gettail_sep(dir) = NUL; + + 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 diff --git a/src/version.c b/src/version.c index 9b5343e9d..61694a467 100644 --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 10, +/**/ 9, /**/ 8, |