Mercurial > vim
comparison src/getchar.c @ 14854:3b72808fbb0d v8.1.0439
patch 8.1.0439: recursive use of getcmdline() still not protected
commit https://github.com/vim/vim/commit/438d176e35c16d56ff3bb7a80300197ce5a30c4f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 30 17:11:48 2018 +0200
patch 8.1.0439: recursive use of getcmdline() still not protected
Problem: Recursive use of getcmdline() still not protected.
Solution: Instead of saving the command buffer when making a call which may
cause recursiveness, save the buffer when actually being called
recursively.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 30 Sep 2018 17:15:08 +0200 |
parents | 0a3b9ecf7cb8 |
children | 27b9a84395b5 |
comparison
equal
deleted
inserted
replaced
14853:5889d7548ac6 | 14854:3b72808fbb0d |
---|---|
4664 int c) /* NUL or typed character for abbreviation */ | 4664 int c) /* NUL or typed character for abbreviation */ |
4665 { | 4665 { |
4666 char_u *res; | 4666 char_u *res; |
4667 char_u *p; | 4667 char_u *p; |
4668 char_u *expr; | 4668 char_u *expr; |
4669 char_u *save_cmd; | |
4670 pos_T save_cursor; | 4669 pos_T save_cursor; |
4671 int save_msg_col; | 4670 int save_msg_col; |
4672 int save_msg_row; | 4671 int save_msg_row; |
4673 | 4672 |
4674 /* Remove escaping of CSI, because "str" is in a format to be used as | 4673 /* Remove escaping of CSI, because "str" is in a format to be used as |
4675 * typeahead. */ | 4674 * typeahead. */ |
4676 expr = vim_strsave(str); | 4675 expr = vim_strsave(str); |
4677 if (expr == NULL) | 4676 if (expr == NULL) |
4678 return NULL; | 4677 return NULL; |
4679 vim_unescape_csi(expr); | 4678 vim_unescape_csi(expr); |
4680 | |
4681 save_cmd = save_cmdline_alloc(); | |
4682 if (save_cmd == NULL) | |
4683 { | |
4684 vim_free(expr); | |
4685 return NULL; | |
4686 } | |
4687 | 4679 |
4688 /* Forbid changing text or using ":normal" to avoid most of the bad side | 4680 /* Forbid changing text or using ":normal" to avoid most of the bad side |
4689 * effects. Also restore the cursor position. */ | 4681 * effects. Also restore the cursor position. */ |
4690 ++textlock; | 4682 ++textlock; |
4691 ++ex_normal_lock; | 4683 ++ex_normal_lock; |
4698 --ex_normal_lock; | 4690 --ex_normal_lock; |
4699 curwin->w_cursor = save_cursor; | 4691 curwin->w_cursor = save_cursor; |
4700 msg_col = save_msg_col; | 4692 msg_col = save_msg_col; |
4701 msg_row = save_msg_row; | 4693 msg_row = save_msg_row; |
4702 | 4694 |
4703 restore_cmdline_alloc(save_cmd); | |
4704 vim_free(expr); | 4695 vim_free(expr); |
4705 | 4696 |
4706 if (p == NULL) | 4697 if (p == NULL) |
4707 return NULL; | 4698 return NULL; |
4708 /* Escape CSI in the result to be able to use the string as typeahead. */ | 4699 /* Escape CSI in the result to be able to use the string as typeahead. */ |