aboutsummaryrefslogtreecommitdiff
path: root/readline/vi_mode.c
diff options
context:
space:
mode:
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 5d146b3f..8930364 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);