From: Antoine Leca Date: Wed, 31 Aug 2011 11:54:31 +0000 (+0200) Subject: Range-check values building mbdev in boot monitor X-Git-Tag: v3.2.0~327 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/invmod.png?a=commitdiff_plain;h=9df7ce09aa6528854f4ee5794351ce129d7a20df;p=minix.git Range-check values building mbdev in boot monitor --- diff --git a/boot/boot/boot.c b/boot/boot/boot.c index 402a4b4c0..4cf600dfe 100644 --- a/boot/boot/boot.c +++ b/boot/boot/boot.c @@ -1228,9 +1228,9 @@ dev_t name2dev(char *name) } } - mbdev = (u32_t)tmpdev.device << 24 - | (u32_t)tmpdev.primary << 16 - | (u32_t)tmpdev.secondary << 8 + mbdev = (u32_t)(tmpdev.device & 0xff) << 24 + | (u32_t)(tmpdev.primary & 0xff) << 16 + | (u32_t)(tmpdev.secondary & 0xff) << 8 /* (-1 & 0xff) is 0xff */ | 0xff; /* Look the name up on the boot device for the UNIX device number. */