summaryrefslogtreecommitdiffstats
path: root/utf8.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2020-05-26 16:01:19 +0100
committerThomas Adam <thomas@xteddy.org>2020-05-26 16:01:19 +0100
commitfd8652ceda9310192f4b3d653f60b4a3bb27156e (patch)
tree2122b50610cff3eabee420212d2f86ee93bbe850 /utf8.c
parenta4cb700269e033b5ad429275d7c61d3c3c2f1af3 (diff)
parent2ced370bee234e00c3ece3b4110dcb71067df846 (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/utf8.c b/utf8.c
index 6676e9f0..c555ecda 100644
--- a/utf8.c
+++ b/utf8.c
@@ -135,12 +135,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)