about summary refs log tree commit diff
path: root/src/locale/iconv.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2017-12-18 22:33:51 -0500
committerRich Felker <dalias@aerifal.cx>2017-12-18 22:33:51 -0500
commit628cf979b249fa76a80962e2eefe05073216a4db (patch)
tree708382f79168a95485809a5d39a357a419fd566c /src/locale/iconv.c
parent95c6044e2ae85846330814c4ac5ebf4102dbe02c (diff)
downloadmusl-628cf979b249fa76a80962e2eefe05073216a4db.tar.gz
musl-628cf979b249fa76a80962e2eefe05073216a4db.tar.xz
musl-628cf979b249fa76a80962e2eefe05073216a4db.zip
fix iconv output of surrogate pairs in ucs2
in the unified code for handling utf-16 and ucs2 output, the check for
ucs2 wrongly looked at the source charset rather than the destination
charset.
Diffstat (limited to 'src/locale/iconv.c')
-rw-r--r--src/locale/iconv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/locale/iconv.c b/src/locale/iconv.c
index c5dd122f..d469856c 100644
--- a/src/locale/iconv.c
+++ b/src/locale/iconv.c
@@ -630,7 +630,7 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
 		case UTF_16:
 		case UTF_16BE:
 		case UTF_16LE:
-			if (c < 0x10000 || type-UCS2BE < 2U) {
+			if (c < 0x10000 || totype-UCS2BE < 2U) {
 				if (c >= 0x10000) c = 0xFFFD;
 				if (*outb < 2) goto toobig;
 				put_16((void *)*out, c, totype);