about summary refs log tree commit diff
path: root/edit.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-02-15 18:53:06 -0500
committerJune McEnroe <june@causal.agency>2021-02-15 19:15:38 -0500
commit3b9e778dacd3392fdf2e8fc29e726b401b50abfe (patch)
treea24ce0c471586eae197090239fba7f3b3535a712 /edit.c
parentDon't expand macro if it can't be converted to mbs (diff)
downloadcatgirl-3b9e778dacd3392fdf2e8fc29e726b401b50abfe.tar.gz
catgirl-3b9e778dacd3392fdf2e8fc29e726b401b50abfe.zip
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.
Diffstat (limited to '')
-rw-r--r--edit.c2
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;
 			}
3.0&id=efa2879ad760f6f12c1aa9d2bb9918f0afe9f084&follow=1'>cgitrc.5: we mean a cgi response, not requestJason A. Donenfeld 2014-07-28ui-stats.c: set parent pointer to NULL after freeing itJohn Keeping 2014-07-28git: update to v2.0.3John Keeping 2014-07-28parsing.c: make commit buffer constJohn Keeping 2014-06-30Bump version.Jason A. Donenfeld 2014-06-29remove debug fprinf() calls that sneaked in with commit 79c985Christian Hesse 2014-06-28git: update to 2.0.1Christian Hesse 2014-06-28ui-patch: Flush stdout after outputting dataJohn Keeping 2014-06-28ui-log: ignore unhandled argumentsJohn Keeping 2014-06-28git: update for git 2.0Christian Hesse 2014-04-17remove trailing whitespaces from source filesChristian Hesse 2014-04-12git: update to 1.9.2Christian Hesse 2014-04-05Fix cgit_parse_url when a repo url is contained in another repo urlJulian Maurice 2014-03-20Makefile: use more reliable git tarball mirrorJason A. Donenfeld 2014-03-20git: update to 1.9.1Christian Hesse