Make sure strsep() gets a nul-terminated string.

Reviewed by:	phk
This commit is contained in:
Giorgos Keramidas 2002-10-10 10:07:19 +00:00
parent 18632a5d66
commit f9e425b336
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104773

View File

@ -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");