summaryrefslogtreecommitdiff
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-05-26 19:49:09 +0200
committerBram Moolenaar <Bram@vim.org>2021-05-26 19:49:09 +0200
commit4c8e8c6e19b75d632b042aa0ba0a2ab769b2162e (patch)
tree872b4fd5b1f177b09972f344cfc1f20ff3246736 /src/ex_docmd.c
parent34fcb697240c1bc9e69417ed75db3b1a83479724 (diff)
downloadvim-git-4c8e8c6e19b75d632b042aa0ba0a2ab769b2162e.tar.gz
patch 8.2.2887: crash when passing null string to fullcommand()v8.2.2887
Problem: Crash when passing null string to fullcommand(). Solution: Check for NULL pointer. (closes #8256)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 2738f4f4d..b52629ed1 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3791,12 +3791,15 @@ f_fullcommand(typval_T *argvars, typval_T *rettv)
char_u *name = argvars[0].vval.v_string;
char_u *p;
- while (name[0] != NUL && name[0] == ':')
+ rettv->v_type = VAR_STRING;
+ rettv->vval.v_string = NULL;
+ if (name == NULL)
+ return;
+
+ while (*name != NUL && *name == ':')
name++;
name = skip_range(name, TRUE, NULL);
- rettv->v_type = VAR_STRING;
-
ea.cmd = (*name == '2' || *name == '3') ? name + 1 : name;
ea.cmdidx = (cmdidx_T)0;
p = find_ex_command(&ea, NULL, NULL, NULL);