diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-10-27 12:58:23 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-10-27 12:58:23 +0200 |
commit | fc3c83e47e22ae510fa5ade38e872ad6d8a21a0a (patch) | |
tree | fe8be329517e71c3db8c2e931cb50020db51a284 /src/ex_getln.c | |
parent | 264e9fd61b92bbf27c00b95537f6bebbbe5324f6 (diff) | |
download | vim-git-fc3c83e47e22ae510fa5ade38e872ad6d8a21a0a.tar.gz |
updated for version 7.3.039v7.3.039
Problem: Crash when using skk.vim plugin.
Solution: Get length of expression evaluation result only after checking for
NULL. (Noriaki Yagi, Dominique Pelle)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 6fa5531d0..c3514874f 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -688,24 +688,27 @@ getcmdline(firstc, count, indent) p = get_expr_line(); --textlock; restore_cmdline(&save_ccline); - len = (int)STRLEN(p); - if (p != NULL && realloc_cmdbuff(len + 1) == OK) + if (p != NULL) { - ccline.cmdlen = len; - STRCPY(ccline.cmdbuff, p); - vim_free(p); - - /* Restore the cursor or use the position set with - * set_cmdline_pos(). */ - if (new_cmdpos > ccline.cmdlen) - ccline.cmdpos = ccline.cmdlen; - else - ccline.cmdpos = new_cmdpos; - - KeyTyped = FALSE; /* Don't do p_wc completion. */ - redrawcmd(); - goto cmdline_changed; + len = (int)STRLEN(p); + if (realloc_cmdbuff(len + 1) == OK) + { + ccline.cmdlen = len; + STRCPY(ccline.cmdbuff, p); + vim_free(p); + + /* Restore the cursor or use the position set with + * set_cmdline_pos(). */ + if (new_cmdpos > ccline.cmdlen) + ccline.cmdpos = ccline.cmdlen; + else + ccline.cmdpos = new_cmdpos; + + KeyTyped = FALSE; /* Don't do p_wc completion. */ + redrawcmd(); + goto cmdline_changed; + } } } beep_flush(); |