mirror of
https://github.com/tmux/tmux.git
synced 2025-09-03 06:17:04 +00:00
Do not use the command if the kernel didn't return the full size.
This commit is contained in:
@ -61,7 +61,7 @@ osdep_get_name(int fd, __unused char *tty)
|
|||||||
size = sizeof kp;
|
size = sizeof kp;
|
||||||
if (sysctl(mib, 4, &kp, &size, NULL, 0) == -1)
|
if (sysctl(mib, 4, &kp, &size, NULL, 0) == -1)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (*kp.kp_proc.p_comm == '\0')
|
if (size != (sizeof kp) || *kp.kp_proc.p_comm == '\0')
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
return (strdup(kp.kp_proc.p_comm));
|
return (strdup(kp.kp_proc.p_comm));
|
||||||
|
Reference in New Issue
Block a user