summaryrefslogtreecommitdiffstats
path: root/sbin/mdconfig
diff options
context:
space:
mode:
authorkeramida <keramida@FreeBSD.org>2002-10-10 10:07:19 +0000
committerkeramida <keramida@FreeBSD.org>2002-10-10 10:07:19 +0000
commit70e019aa6b1aca06de62428dd78df28d795c27c4 (patch)
tree4de2ad54404f5b03a6578e7065d29e32a4e1b954 /sbin/mdconfig
parent0463428dc7cb7ce5e8554af1144e746b11745557 (diff)
downloadFreeBSD-src-70e019aa6b1aca06de62428dd78df28d795c27c4.zip
FreeBSD-src-70e019aa6b1aca06de62428dd78df28d795c27c4.tar.gz
Make sure strsep() gets a nul-terminated string.
Reviewed by: phk
Diffstat (limited to 'sbin/mdconfig')
-rw-r--r--sbin/mdconfig/mdconfig.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c
index a1c125ec..c777000 100644
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
@@ -211,8 +211,9 @@ list(const int fd)
if (sysctlbyname("kern.disks", NULL, &dll, NULL, 0) == -1)
err(1, "sysctlbyname: kern.disks");
- if ( (disklist = malloc(dll)) == NULL)
+ if ( (disklist = malloc(dll + 1)) == NULL)
err(1, "malloc");
+ bzero(disklist, dll + 1);
if (sysctlbyname("kern.disks", disklist, &dll, NULL, 0) == -1)
err(1, "sysctlbyname: kern.disks");
OpenPOWER on IntegriCloud