Mercurial > vim
comparison src/ex_getln.c @ 2617:f2927225367a v7.3.039
updated for version 7.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)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 27 Oct 2010 12:58:23 +0200 |
parents | b57f2617965f |
children | 0de47f0d731e |
comparison
equal
deleted
inserted
replaced
2616:73d947c20291 | 2617:f2927225367a |
---|---|
686 save_cmdline(&save_ccline); | 686 save_cmdline(&save_ccline); |
687 ++textlock; | 687 ++textlock; |
688 p = get_expr_line(); | 688 p = get_expr_line(); |
689 --textlock; | 689 --textlock; |
690 restore_cmdline(&save_ccline); | 690 restore_cmdline(&save_ccline); |
691 len = (int)STRLEN(p); | 691 |
692 | 692 if (p != NULL) |
693 if (p != NULL && realloc_cmdbuff(len + 1) == OK) | |
694 { | 693 { |
695 ccline.cmdlen = len; | 694 len = (int)STRLEN(p); |
696 STRCPY(ccline.cmdbuff, p); | 695 if (realloc_cmdbuff(len + 1) == OK) |
697 vim_free(p); | 696 { |
698 | 697 ccline.cmdlen = len; |
699 /* Restore the cursor or use the position set with | 698 STRCPY(ccline.cmdbuff, p); |
700 * set_cmdline_pos(). */ | 699 vim_free(p); |
701 if (new_cmdpos > ccline.cmdlen) | 700 |
702 ccline.cmdpos = ccline.cmdlen; | 701 /* Restore the cursor or use the position set with |
703 else | 702 * set_cmdline_pos(). */ |
704 ccline.cmdpos = new_cmdpos; | 703 if (new_cmdpos > ccline.cmdlen) |
705 | 704 ccline.cmdpos = ccline.cmdlen; |
706 KeyTyped = FALSE; /* Don't do p_wc completion. */ | 705 else |
707 redrawcmd(); | 706 ccline.cmdpos = new_cmdpos; |
708 goto cmdline_changed; | 707 |
708 KeyTyped = FALSE; /* Don't do p_wc completion. */ | |
709 redrawcmd(); | |
710 goto cmdline_changed; | |
711 } | |
709 } | 712 } |
710 } | 713 } |
711 beep_flush(); | 714 beep_flush(); |
712 c = ESC; | 715 c = ESC; |
713 } | 716 } |