mirror of
https://github.com/fluencelabs/musl
synced 2025-04-25 15:22:15 +00:00
fix iconv buffer overflow converting to legacy JIS-based encodings
maintainer's notes: commit a223dbd27ae36fe53f9f67f86caf685b729593fc added the reverse conversions to JIS-based encodings, but omitted the check for remining buffer space in the case where the next character to be written was single-byte, allowing conversion to continue past the end of the destination buffer.
This commit is contained in:
parent
40bae2d32f
commit
55a661ff5e
@ -539,6 +539,7 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
|
|||||||
if (*outb < 1) goto toobig;
|
if (*outb < 1) goto toobig;
|
||||||
if (c<256 && c==legacy_map(tomap, c)) {
|
if (c<256 && c==legacy_map(tomap, c)) {
|
||||||
revout:
|
revout:
|
||||||
|
if (*outb < 1) goto toobig;
|
||||||
*(*out)++ = c;
|
*(*out)++ = c;
|
||||||
*outb -= 1;
|
*outb -= 1;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user