aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorThomas Schmitt <scdbackup@gmx.net>2014-06-22 22:24:17 +0200
committerH. Peter Anvin <hpa@zytor.com>2014-06-23 19:48:54 -0700
commit8059839edcfe819ca9cd135c67a905eb53943204 (patch)
tree0567f9474c44733534756035c408fb20a531704c /utils
parentede6eb35f3cd70a90cbcd10f72276afd449642a9 (diff)
downloadsyslinux-8059839edcfe819ca9cd135c67a905eb53943204.tar.gz
syslinux-8059839edcfe819ca9cd135c67a905eb53943204.tar.xz
syslinux-8059839edcfe819ca9cd135c67a905eb53943204.zip
utils/isohybrid.c: Encode GPT partition names as UTF-16LE
The worst sin of isohybrid.c was to compose GPT partition names by 8-bit characters and to memcpy() them as if they were 16 bit wide. GPT names are encoded as UTF-16LE. It is trivial to create this encoding from 7-bit ASCII. This change introduces two byte arrays with the desired UTF-16LE names which replace the string constants "ISOHybrid ISO" and "ISOHybrid". Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/isohybrid.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/utils/isohybrid.c b/utils/isohybrid.c
index 05afd299..c5b42814 100644
--- a/utils/isohybrid.c
+++ b/utils/isohybrid.c
@@ -749,6 +749,11 @@ initialise_gpt(uint8_t *gpt, uint32_t current, uint32_t alternate, int primary)
struct gpt_part_header *part;
int hole = 0;
int gptsize = 128 / 4 + 2;
+ char part_name_iso[] = {'I', 0, 'S', 0, 'O', 0, 'H', 0, 'y', 0,
+ 'b', 0, 'r', 0, 'i', 0, 'd', 0, ' ', 0,
+ 'I', 0, 'S', 0, 'O', 0, 0, 0};
+ char part_name_bootimg[]= {'I', 0, 'S', 0, 'O', 0, 'H', 0, 'y', 0,
+ 'b', 0, 'r', 0, 'i', 0, 'd', 0, 0, 0};
if (mac_lba) {
/* 2048 bytes per partition, plus round to 2048 boundary */
@@ -793,7 +798,7 @@ initialise_gpt(uint8_t *gpt, uint32_t current, uint32_t alternate, int primary)
memcpy(part->partTypeGUID, basic_partition, sizeof(uuid_t));
part->firstLBA = lendian_64(0);
part->lastLBA = lendian_64(psize);
- memcpy(part->name, "ISOHybrid ISO", 28);
+ memcpy(part->name, part_name_iso, 28);
gpt += sizeof(struct gpt_part_header);
part++;
@@ -802,7 +807,7 @@ initialise_gpt(uint8_t *gpt, uint32_t current, uint32_t alternate, int primary)
memcpy(part->partTypeGUID, basic_partition, sizeof(uuid_t));
part->firstLBA = lendian_64(efi_lba * 4);
part->lastLBA = lendian_64(part->firstLBA + efi_count - 1);
- memcpy(part->name, "ISOHybrid", 20);
+ memcpy(part->name, part_name_bootimg, 20);
gpt += sizeof(struct gpt_part_header);
@@ -815,7 +820,7 @@ initialise_gpt(uint8_t *gpt, uint32_t current, uint32_t alternate, int primary)
memcpy(part->partTypeGUID, hfs_partition, sizeof(uuid_t));
part->firstLBA = lendian_64(mac_lba * 4);
part->lastLBA = lendian_64(part->firstLBA + mac_count - 1);
- memcpy(part->name, "ISOHybrid", 20);
+ memcpy(part->name, part_name_bootimg, 20);
part--;
}