summaryrefslogtreecommitdiffstats
path: root/osdep-darwin.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2020-04-15 13:04:20 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2020-04-15 13:04:53 +0100
commitc2c9b77f141f3462414789b696dcee2cc2789bc4 (patch)
tree40b04cc5db4fc36719db4a74fcffc206da1f78e4 /osdep-darwin.c
parent533c5ee7ad8c6d6e4eb2d05d8fc61c1e11a2705e (diff)
Do not use the command if the kernel didn't return the full size.
Diffstat (limited to 'osdep-darwin.c')
-rw-r--r--osdep-darwin.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/osdep-darwin.c b/osdep-darwin.c
index d4a88028..6b2b1d72 100644
--- a/osdep-darwin.c
+++ b/osdep-darwin.c
@@ -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));