Make sure strsep() gets a nul-terminated string.
Reviewed by: phk
This commit is contained in:
parent
18632a5d66
commit
f9e425b336
@ -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");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user