aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-06-21 17:33:57 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-06-21 17:33:57 -0700
commit1004a727316071be17d7983323e736ee3b70ed01 (patch)
tree97be0ac3ef8799e9e277d071769bb3c9502712e8 /utils
parent1d0c49827da98d852d42fadd56b073ad3d3f1faa (diff)
downloadsyslinux-1004a727316071be17d7983323e736ee3b70ed01.tar.gz
syslinux-1004a727316071be17d7983323e736ee3b70ed01.tar.xz
syslinux-1004a727316071be17d7983323e736ee3b70ed01.zip
memdiskfind: sanity check the FBM value
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/memdiskfind.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/utils/memdiskfind.c b/utils/memdiskfind.c
index 331bfb35..45d54bc7 100644
--- a/utils/memdiskfind.c
+++ b/utils/memdiskfind.c
@@ -93,13 +93,16 @@ int main(int argc, char *argv[])
munmap((void *)map, 4096);
+ if (fbm < 64 || fbm >= 640)
+ return 1;
+
mapbase = (fbm << 10) & ~(page - 1);
maplen = 0xa0000 - mapbase;
map = mmap(NULL, maplen, PROT_READ, MAP_SHARED, memfd, mapbase);
if (map == MAP_FAILED) {
fprintf(stderr, "%s: cannot map base memory: %s\n",
argv[0], strerror(errno));
- exit(1);
+ return 2;
}
ptr = map + ((fbm << 10) & (page - 1));