iconv: Fix a buffer overflow in the HZ encoding

wcrtomb may store up to 2 2-byte escape sequences to the state buffer in
addition to the character itself.  In the worst case, a 3-byte heap
overflow is possible.

Approved by:	so
Security:	FreeBSD-SA-26:49.iconv
Security:	CVE-2026-58081
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D57949
This commit is contained in:
Mark Johnston committed 2026-06-30 17:00:23 +00:00
1 parent 2ee2274244
commit 8bc3abb7d7
1 file changed
+1 -1
+1 -1
View File
@@ -132,7 +132,7 @@ typedef struct {
typedef struct {
escape_t *inuse;
int chlen;
char ch[ROWCOL_MAX];
char ch[4 + ROWCOL_MAX];
} _HZState;
#define _CEI_TO_EI(_cei_) (&(_cei_)->ei)