author | Rich Felker <dalias@aerifal.cx> | 2025年02月12日 17:06:30 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2025年02月12日 17:06:30 -0500 |
commit | c47ad25ea3b484e10326f933e927c0bc8cded3da (patch) | |
tree | 2c1d63ea8a44fdba4477fcb505ab3a357a20bb08 /src | |
parent | 4c4f15dae57125e5b65b9690901384ae501d38e2 (diff) | |
download | musl-c47ad25ea3b484e10326f933e927c0bc8cded3da.tar.gz |
-rw-r--r-- | src/locale/iconv.c | 4 |
diff --git a/src/locale/iconv.c b/src/locale/iconv.c index 008c93f0..52178950 100644 --- a/src/locale/iconv.c +++ b/src/locale/iconv.c @@ -545,6 +545,10 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri if (*outb < k) goto toobig; memcpy(*out, tmp, k); } else k = wctomb_utf8(*out, c); + /* This failure condition should be unreachable, but + * is included to prevent decoder bugs from translating + * into advancement outside the output buffer range. */ + if (k>4) goto ilseq; *out += k; *outb -= k; break; |