diff options
| author | Peter Jones <pjones@redhat.com> | 2017-09-26 10:52:46 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2017-09-26 11:16:45 -0400 |
| commit | 23ce039c434d164a3848c829b237899cc17c1d21 (patch) | |
| tree | 46f64603587d301a61ba68aa78be493a45c5cf0e /lib/variables.c | |
| parent | 49e9775e07cf4b29d7323e2892246e83b7451efc (diff) | |
| download | efi-boot-shim-23ce039c434d164a3848c829b237899cc17c1d21.tar.gz efi-boot-shim-23ce039c434d164a3848c829b237899cc17c1d21.zip | |
Use iconv for UCS-2 encoding.
Cyphermox discovered that when you run this:
( printf "\xff\x00\xfe\x00" ; echo "shimx64.efi,foo,,This is the boot entry for foo" ) | sed -z 's/./&\x00/g'
on some debian machines, printf(1) doesn't interpret the \x.. characters,
and that results in this being the encoded text:
00000000 5c 78 66 66 5c 78 66 65 73 00 68 00 69 00 6d 00 |\xff\xfes.h.i.m.|
00000010 78 00 36 00 34 00 2e 00 65 00 66 00 69 00 2c 00 |x.6.4...e.f.i.,.|
00000020 66 00 6f 00 6f 00 2c 00 2c 00 54 00 68 00 69 00 |f.o.o.,.,.T.h.i.|
which... yeah, that's wrong. So instead, use iconv instead of
printf+sed to encode it in UCS-2. Unfortunately, that means we don't
get endian markers, because for some reason iconv(1) doesn't have any way
to say it should include them. But that's okay; fallback already
handles not having them and just assumes the second byte being \x00
means UCS-2LE.
Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'lib/variables.c')
0 files changed, 0 insertions, 0 deletions
