diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-05-26 12:50:04 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-05-26 12:50:04 +0000 |
commit | 3edebeedc22bd15074c578a2717ffdf955b1a436 (patch) | |
tree | f945748fa867b6da26d7d3be1c66362ea84cc74c /usr.bin/tmux/utf8.c | |
parent | a65215be93f90f3470fe91ace96f41c8cb3a5b79 (diff) |
Return new character properly when converting to data.
Diffstat (limited to 'usr.bin/tmux/utf8.c')
-rw-r--r-- | usr.bin/tmux/utf8.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.bin/tmux/utf8.c b/usr.bin/tmux/utf8.c index f753d04c1e4..3366a9b3856 100644 --- a/usr.bin/tmux/utf8.c +++ b/usr.bin/tmux/utf8.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utf8.c,v 1.48 2020/05/25 18:57:25 nicm Exp $ */ +/* $OpenBSD: utf8.c,v 1.49 2020/05/26 12:50:03 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -136,12 +136,16 @@ utf8_from_data(const struct utf8_data *ud, utf8_char *uc) u_int offset; if (ud->width != 1 && ud->width != 2) - return (utf8_space1.uc); + fatalx("invalid UTF-8 width"); + if (ud->size == 0) + fatalx("invalid UTF-8 size"); if (ud->size > UTF8_FLAG_SIZE) goto fail; - if (ud->size == 1) - return (utf8_build_one(ud->data[0], 1)); + if (ud->size == 1) { + *uc = utf8_build_one(ud->data[0], 1); + return (UTF8_DONE); + } m.flags = ud->size; if (ud->width == 2) |