Clear destination char when converting from wchar_t or the result could

include stack garbage. GitHub issue 5792 from hrajyw4 at gmail dot com.
This commit is contained in:
nicm authored and tmux update bot committed 2026-10-23 11:12:21 +00:00
1 parent ecc43170f8
commit d075ed22a0
1 file changed
+3 -1
+3 -1
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: utf8.c,v 1.75 2026/10/13 10:21:58 nicm Exp $ */
/* $OpenBSD: utf8.c,v 1.76 2026/10/23 06:30:50 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -667,6 +667,8 @@ utf8_fromwc(wchar_t wc, struct utf8_data *ud)
{
int size, width;
memset(ud, 0, sizeof *ud);
size = wctomb(ud->data, wc);
if (size < 0) {
log_debug("UTF-8 %d, wctomb() %d", wc, errno);