Mercurial > vim
comparison src/ex_docmd.c @ 24697:a6e43da449af v8.2.2887
patch 8.2.2887: crash when passing null string to fullcommand()
Commit: https://github.com/vim/vim/commit/4c8e8c6e19b75d632b042aa0ba0a2ab769b2162e
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed May 26 19:49:09 2021 +0200
patch 8.2.2887: crash when passing null string to fullcommand()
Problem: Crash when passing null string to fullcommand().
Solution: Check for NULL pointer. (closes https://github.com/vim/vim/issues/8256)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 26 May 2021 20:00:07 +0200 |
parents | 661d15592d3c |
children | b19c8150ee9d |
comparison
equal
deleted
inserted
replaced
24696:dc0703c51aef | 24697:a6e43da449af |
---|---|
3789 { | 3789 { |
3790 exarg_T ea; | 3790 exarg_T ea; |
3791 char_u *name = argvars[0].vval.v_string; | 3791 char_u *name = argvars[0].vval.v_string; |
3792 char_u *p; | 3792 char_u *p; |
3793 | 3793 |
3794 while (name[0] != NUL && name[0] == ':') | 3794 rettv->v_type = VAR_STRING; |
3795 rettv->vval.v_string = NULL; | |
3796 if (name == NULL) | |
3797 return; | |
3798 | |
3799 while (*name != NUL && *name == ':') | |
3795 name++; | 3800 name++; |
3796 name = skip_range(name, TRUE, NULL); | 3801 name = skip_range(name, TRUE, NULL); |
3797 | |
3798 rettv->v_type = VAR_STRING; | |
3799 | 3802 |
3800 ea.cmd = (*name == '2' || *name == '3') ? name + 1 : name; | 3803 ea.cmd = (*name == '2' || *name == '3') ? name + 1 : name; |
3801 ea.cmdidx = (cmdidx_T)0; | 3804 ea.cmdidx = (cmdidx_T)0; |
3802 p = find_ex_command(&ea, NULL, NULL, NULL); | 3805 p = find_ex_command(&ea, NULL, NULL, NULL); |
3803 if (p == NULL || ea.cmdidx == CMD_SIZE) | 3806 if (p == NULL || ea.cmdidx == CMD_SIZE) |