diff options
author | Pali Rohár | 2017-05-16 23:52:05 +0200 |
---|---|---|
committer | Pali Rohár | 2017-05-16 23:52:05 +0200 |
commit | 22acc2681de1ae2e10d7f1e7e62538af37bc2982 (patch) | |
tree | 31a64b2fd5ff573c0ff9032821af95843ae2229c /libblkid | |
parent | libblkid: Add support for Latin1 encoding in blkid_encode_to_utf8() (diff) | |
download | kernel-qcow2-util-linux-22acc2681de1ae2e10d7f1e7e62538af37bc2982.tar.gz kernel-qcow2-util-linux-22acc2681de1ae2e10d7f1e7e62538af37bc2982.tar.xz kernel-qcow2-util-linux-22acc2681de1ae2e10d7f1e7e62538af37bc2982.zip |
libblkid: udf: Correctly handle UDF strings encoded in 8bit OSTA Compressed Unicode
String encoded in 8bit OSTA Compressed Unicode contains one Unicode
codepoint per 8bits. Maximal Unicode codepoint is U+FF. Which effectively
means that it is equivalent to Latin1 encoding.
Before this patch libblkid copied raw 8bit OSTA Compressed Unicode from
disk and treated it as UTF-8. It worked fine just for UTF-8 invariants,
other characters were incorrectly encoded. This patch fixes this problem.
Note that processing UUID is not fixed in this patch.
Diffstat (limited to 'libblkid')
-rw-r--r-- | libblkid/src/superblocks/udf.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/libblkid/src/superblocks/udf.c b/libblkid/src/superblocks/udf.c index 36769779f..96254d881 100644 --- a/libblkid/src/superblocks/udf.c +++ b/libblkid/src/superblocks/udf.c @@ -218,8 +218,9 @@ real_blksz: if (!have_volid) { uint8_t clen = vd->type.primary.ident.clen; if (clen == 8) - have_volid = !blkid_probe_set_id_label(pr, "VOLUME_ID", - vd->type.primary.ident.c, 31); + have_volid = !blkid_probe_set_utf8_id_label(pr, "VOLUME_ID", + vd->type.primary.ident.c, 31, + BLKID_ENC_LATIN1); else if (clen == 16) have_volid = !blkid_probe_set_utf8_id_label(pr, "VOLUME_ID", vd->type.primary.ident.c, 31, @@ -261,8 +262,9 @@ real_blksz: if (!have_volsetid) { uint8_t clen = vd->type.primary.volset_id.clen; if (clen == 8) - have_volsetid = !blkid_probe_set_id_label(pr, "VOLUME_SET_ID", - vd->type.primary.volset_id.c, 127); + have_volsetid = !blkid_probe_set_utf8_id_label(pr, "VOLUME_SET_ID", + vd->type.primary.volset_id.c, 127, + BLKID_ENC_LATIN1); else if (clen == 16) have_volsetid = !blkid_probe_set_utf8_id_label(pr, "VOLUME_SET_ID", vd->type.primary.volset_id.c, 127, @@ -299,11 +301,13 @@ real_blksz: uint8_t clen = vd->type.logical.logvol_id.clen; if (clen == 8) { if (!have_label) - have_label = !blkid_probe_set_label(pr, - vd->type.logical.logvol_id.c, 127); + have_label = !blkid_probe_set_utf8label(pr, + vd->type.logical.logvol_id.c, 127, + BLKID_ENC_LATIN1); if (!have_logvolid) - have_logvolid = !blkid_probe_set_id_label(pr, "LOGICAL_VOLUME_ID", - vd->type.logical.logvol_id.c, 127); + have_logvolid = !blkid_probe_set_utf8_id_label(pr, "LOGICAL_VOLUME_ID", + vd->type.logical.logvol_id.c, 127, + BLKID_ENC_LATIN1); } else if (clen == 16) { if (!have_label) have_label = !blkid_probe_set_utf8label(pr, |