From: nicm Date: Mon, 20 Dec 2021 09:02:12 +0000 (+0000) Subject: Do not crash on a zero size character. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2196189682788d5363cd2e96093e0c7c7d3ae08a;p=openbsd Do not crash on a zero size character. --- diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 12a0e23767c..c6e42c861a6 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.331 2021/10/11 10:55:31 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.332 2021/12/20 09:02:12 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -3148,6 +3148,11 @@ window_copy_cellstring(const struct grid_line *gl, u_int px, size_t *size, } utf8_to_data(gl->extddata[gce->offset].data, &ud); + if (ud.size == 0) { + *size = 0; + *allocated = 0; + return (NULL); + } *size = ud.size; *allocated = 1;