summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-06-02 11:29:00 +0000
committernicm <nicm@openbsd.org>2020-06-02 11:29:00 +0000
commit14d88b91f642bc816b070c8daab63cf4a5ac4a65 (patch)
treeafc7ba3d6f6f2a1d5126b99659823f2d65d42e1d
parentUse CLOCK_MONOTONIC for timer measurement and add a timestamp to control (diff)
downloadwireguard-openbsd-14d88b91f642bc816b070c8daab63cf4a5ac4a65.tar.xz
wireguard-openbsd-14d88b91f642bc816b070c8daab63cf4a5ac4a65.zip
Fail rather than fatal on UTF-8 width 0.
-rw-r--r--usr.bin/tmux/utf8.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/tmux/utf8.c b/usr.bin/tmux/utf8.c
index 3366a9b3856..7c0f1eb8456 100644
--- a/usr.bin/tmux/utf8.c
+++ b/usr.bin/tmux/utf8.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utf8.c,v 1.49 2020/05/26 12:50:03 nicm Exp $ */
+/* $OpenBSD: utf8.c,v 1.50 2020/06/02 11:29:00 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -135,6 +135,8 @@ utf8_from_data(const struct utf8_data *ud, utf8_char *uc)
union utf8_map m = { .uc = 0 };
u_int offset;
+ if (ud->width == 0)
+ goto fail;
if (ud->width != 1 && ud->width != 2)
fatalx("invalid UTF-8 width");
if (ud->size == 0)