summaryrefslogtreecommitdiff
path: root/readline/vi_mode.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2004-01-27 22:25:15 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2004-01-27 22:25:15 +0000
commit9564d469d6ef0fb45f841e755aad4b5e0f9e0d9c (patch)
treebe8aece34c90a74ae04c6760893930e4ac03af41 /readline/vi_mode.c
parentfd4ca68fcfdef4d41e6b317a2f01c59d56a034e9 (diff)
downloadgdb-9564d469d6ef0fb45f841e755aad4b5e0f9e0d9c.tar.gz
2004-01-27 Elena Zannoni <ezannoni@redhat.com>
Merge in official patches to readline-4.3 from ftp://ftp.cwru.edu/pub/bash/readline-4.3-patches: NOTE: Patch-ID readline-43-004 was already applied (see below). * bind.c (rl_generic_bind): Pressing certain key sequences causes an infinite loop in _rl_dispatch_subseq with the `key' argument set to 256. This eventually causes bash to exceed the stack size limit and crash with a segmentation violation. Patch-ID: readline43-001. * readline.c (_rl_dispatch_subseq): Repeating an edit in vi-mode with `.' does not work. Patch-ID: readline43-002. * mbutil.c (_rl_get_char_len, _rl_compare_chars, _rl_adjust_point): When in a locale with multibyte characters, the readline display updater will occasionally cause a segmentation fault when attempting to compute the length of the first multibyte character on the line. Patch-ID: readline43-003. * vi_mode.c (_rl_vi_change_mbchar_case): Using the vi editing mode's case-changing commands in a locale with multibyte characters will cause garbage characters to be inserted into the editing buffer. Patch-ID: readline43-005.
Diffstat (limited to 'readline/vi_mode.c')
-rw-r--r--readline/vi_mode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/readline/vi_mode.c b/readline/vi_mode.c
index 5d146b3f705..89303644c59 100644
--- a/readline/vi_mode.c
+++ b/readline/vi_mode.c
@@ -680,7 +680,8 @@ _rl_vi_change_mbchar_case (count)
int count;
{
wchar_t wc;
- char mb[MB_LEN_MAX];
+ char mb[MB_LEN_MAX+1];
+ int mblen;
mbstate_t ps;
memset (&ps, 0, sizeof (mbstate_t));
@@ -703,7 +704,9 @@ _rl_vi_change_mbchar_case (count)
/* Vi is kind of strange here. */
if (wc)
{
- wctomb (mb, wc);
+ mblen = wctomb (mb, wc);
+ if (mblen >= 0)
+ mb[mblen] = '\0';
rl_begin_undo_group ();
rl_delete (1, 0);
rl_insert_text (mb);