diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-07-17 20:57:50 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-07-17 20:57:50 +0000 |
commit | a40458f5fe5439122e2b2b6f1bbf98643e9da584 (patch) | |
tree | a42bbf279a3482f07bf0614baaf924f5e4f4818c /sys | |
parent | 10561b5c9ceb18a25e230050ece982bb31eb35d8 (diff) |
It takes a greek to put buffer overflow and unterminated string
handling into the kernel. Stick with the complicated stuff dude,
breaking this simple shit is killing us!
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_sysctl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index f8a636256a3..d2f2b25a5de 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.54 2001/07/13 23:46:12 mickey Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.55 2001/07/17 20:57:49 deraadt Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -965,6 +965,7 @@ sysctl_diskinit(update, p) for (dk = TAILQ_FIRST(&disklist), tlen = 0; dk; dk = TAILQ_NEXT(dk, dk_link)) tlen += strlen(dk->dk_name) + 1; + tlen++; if (disknames) free(disknames, M_SYSCTL); @@ -975,6 +976,7 @@ sysctl_diskinit(update, p) diskstats = malloc(disk_count * sizeof(struct diskstats), M_SYSCTL, M_WAITOK); disknames = malloc(tlen, M_SYSCTL, M_WAITOK); + disknames[0] = '\0'; for (dk = TAILQ_FIRST(&disklist), i = 0, l = 0; dk; dk = TAILQ_NEXT(dk, dk_link), i++) { |