diff options
author | Sergey Vlasov <vsu@altlinux.ru> | 2008-07-16 15:13:21 +0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-07-16 08:27:41 -0700 |
commit | b5f0b61236a5300fe425cf80b11c5bc0006873c7 (patch) | |
tree | ea12baf8431df35f7bcc3fa356a86dd9abc2d0a4 | |
parent | c4e683cea05b735fe793a5fe0f49584db3a5c67c (diff) | |
download | syslinux-b5f0b61236a5300fe425cf80b11c5bc0006873c7.tar.gz |
chain.c32: fix test for partition types which can be hiddensyslinux-3.71-pre11
The result of shift in C is undefined if the shift count is greater
than the width of type. On x86 the corresponding CPU instruction
masks the shift count with 0x1f, therefore (mask >> (t & ~0x10)) & 1)
gives false positives for types greater than 0x1f (e.g., the partition
type 0x8e (Linux LVM) could be "hidden" to 0x9e).
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | com32/modules/chain.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/com32/modules/chain.c b/com32/modules/chain.c index 9ca118c0..2f79aaf4 100644 --- a/com32/modules/chain.c +++ b/com32/modules/chain.c @@ -626,7 +626,7 @@ static int hide_unhide(char *mbr, int part) for (i = 1; i <= 4; i++) { pt = (struct part_entry *)&mbr[0x1be + 16*(i-1)]; t = pt->ostype; - if ((mask >> (t & ~0x10)) & 1) { + if ((t <= 0x1f) && ((mask >> (t & ~0x10)) & 1)) { /* It's a hideable partition type */ if (i == part) t &= ~0x10; /* unhide */ |