Do not use the command if the kernel didn't return the full size.

pull/2172/head
Nicholas Marriott 2020-04-15 13:04:20 +01:00
parent 533c5ee7ad
commit c2c9b77f14
1 changed files with 1 additions and 1 deletions

View File

@ -61,7 +61,7 @@ osdep_get_name(int fd, __unused char *tty)
size = sizeof kp;
if (sysctl(mib, 4, &kp, &size, NULL, 0) == -1)
return (NULL);
if (*kp.kp_proc.p_comm == '\0')
if (size != (sizeof kp) || *kp.kp_proc.p_comm == '\0')
return (NULL);
return (strdup(kp.kp_proc.p_comm));