diff options
author | C. McEnroe | 2021-02-15 18:53:06 -0500 |
---|---|---|
committer | C. McEnroe | 2021-02-15 19:15:38 -0500 |
commit | 3b9e778dacd3392fdf2e8fc29e726b401b50abfe (patch) | |
tree | a24ce0c471586eae197090239fba7f3b3535a712 | |
parent | a92f1260ea8fa662f0944a4941c8d87b37b15761 (diff) |
Don't insert wchar_t if it can't be converted to mbs
Otherwise it could hit the assertion in editBuffer while converting to mbs for consumption by the rest of the program. It's possibly to trigger this with LC_ALL=C and typing C-z C-v M-a, for example.
-rw-r--r-- | edit.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/edit.c b/edit.c index fc23c58..3e7e1af 100644 --- a/edit.c +++ b/edit.c @@ -260,6 +260,8 @@ void edit(uint id, enum Edit op, wchar_t ch) { } break; case EditInsert: { + char mb[MB_LEN_MAX]; + if (wctomb(mb, ch) < 0) return; if (reserve(pos, 1)) { buf[pos++] = ch; } |