aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Vlasov <vsu@altlinux.ru>2008-07-16 15:13:21 +0400
committerH. Peter Anvin <hpa@zytor.com>2008-07-16 08:27:41 -0700
commitb5f0b61236a5300fe425cf80b11c5bc0006873c7 (patch)
treeea12baf8431df35f7bcc3fa356a86dd9abc2d0a4
parentc4e683cea05b735fe793a5fe0f49584db3a5c67c (diff)
downloadsyslinux-elf-syslinux-3.71-pre11.tar.gz
syslinux-elf-syslinux-3.71-pre11.tar.xz
syslinux-elf-syslinux-3.71-pre11.zip
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.c2
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 */