From 9df7ce09aa6528854f4ee5794351ce129d7a20df Mon Sep 17 00:00:00 2001 From: Antoine Leca Date: Wed, 31 Aug 2011 13:54:31 +0200 Subject: [PATCH] Range-check values building mbdev in boot monitor --- boot/boot/boot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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. */ -- 2.44.0