diff options
author | Archie Cobbs <archie@FreeBSD.org> | 1998-12-04 22:54:57 +0000 |
---|---|---|
committer | Archie Cobbs <archie@FreeBSD.org> | 1998-12-04 22:54:57 +0000 |
commit | 2127f26023a9be443e05b592b35c77b454ba8f77 (patch) | |
tree | 951cf624a9440f22eae605ca46c2e80246f1bf08 /sys/amd64 | |
parent | 790eeb2b519441c661126930cec65560727a8ec5 (diff) | |
download | src-2127f26023a9be443e05b592b35c77b454ba8f77.tar.gz src-2127f26023a9be443e05b592b35c77b454ba8f77.zip |
Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
for possible buffer overflow problems. Replaced most sprintf()'s
with snprintf(); for others cases, added terminating NUL bytes where
appropriate, replaced constants like "16" with sizeof(), etc.
These changes include several bug fixes, but most changes are for
maintainability's sake. Any instance where it wasn't "immediately
obvious" that a buffer overflow could not occur was made safer.
Reviewed by: Bruce Evans <bde@zeta.org.au>
Reviewed by: Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by: Mike Spengler <mks@networkcs.com>
Notes
Notes:
svn path=/head/; revision=41514
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/isa/intr_machdep.c | 4 | ||||
-rw-r--r-- | sys/amd64/isa/nmi.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/amd64/isa/intr_machdep.c b/sys/amd64/isa/intr_machdep.c index 3f891f2af315..08c20498480b 100644 --- a/sys/amd64/isa/intr_machdep.c +++ b/sys/amd64/isa/intr_machdep.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: intr_machdep.c,v 1.13 1998/06/18 16:08:46 bde Exp $ + * $Id: intr_machdep.c,v 1.14 1998/09/06 22:41:41 tegge Exp $ */ #include "opt_auto_eoi.h" @@ -325,7 +325,7 @@ find_device_id(int irq) char *cp; int free_id, id; - sprintf(buf, "pci irq%d", irq); + snprintf(buf, sizeof(buf), "pci irq%d", irq); cp = intrnames; /* default to 0, which corresponds to clk0 */ free_id = 0; diff --git a/sys/amd64/isa/nmi.c b/sys/amd64/isa/nmi.c index 3f891f2af315..08c20498480b 100644 --- a/sys/amd64/isa/nmi.c +++ b/sys/amd64/isa/nmi.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: intr_machdep.c,v 1.13 1998/06/18 16:08:46 bde Exp $ + * $Id: intr_machdep.c,v 1.14 1998/09/06 22:41:41 tegge Exp $ */ #include "opt_auto_eoi.h" @@ -325,7 +325,7 @@ find_device_id(int irq) char *cp; int free_id, id; - sprintf(buf, "pci irq%d", irq); + snprintf(buf, sizeof(buf), "pci irq%d", irq); cp = intrnames; /* default to 0, which corresponds to clk0 */ free_id = 0; |