summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-07-02 18:00:51 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-07-02 18:00:51 +0000
commit70100c740fc1c882ebd7845fad4149759daa87f4 (patch)
tree3dbba4e301690e328d860caf6f5cb64a75ec2937 /sys
parent6d17e46779590d85228dfab86c00fd2ca968fa31 (diff)
Stricter bounds checking for mmap() calls.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mvme68k/dev/nvram.c4
-rw-r--r--sys/arch/mvme68k/dev/sram.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/mvme68k/dev/nvram.c b/sys/arch/mvme68k/dev/nvram.c
index 2cae7e8cdf4..de60a8e32de 100644
--- a/sys/arch/mvme68k/dev/nvram.c
+++ b/sys/arch/mvme68k/dev/nvram.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nvram.c,v 1.13 2004/07/02 17:37:16 miod Exp $ */
+/* $OpenBSD: nvram.c,v 1.14 2004/07/02 18:00:50 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -415,7 +415,7 @@ nvrammmap(dev, off, prot)
return (-1);
/* allow access only in RAM */
- if (off > sc->sc_len)
+ if (off < 0 || off > sc->sc_len)
return (-1);
return (m68k_btop(sc->sc_paddr + off));
}
diff --git a/sys/arch/mvme68k/dev/sram.c b/sys/arch/mvme68k/dev/sram.c
index f5b6fe70650..6008c82b6e7 100644
--- a/sys/arch/mvme68k/dev/sram.c
+++ b/sys/arch/mvme68k/dev/sram.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sram.c,v 1.13 2004/07/02 17:37:16 miod Exp $ */
+/* $OpenBSD: sram.c,v 1.14 2004/07/02 18:00:50 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -216,7 +216,7 @@ srammmap(dev, off, prot)
return (-1);
/* allow access only in RAM */
- if (off > sc->sc_len)
+ if (off < 0 || off > sc->sc_len)
return (-1);
return (m68k_btop(sc->sc_paddr + off));
}