From 673603dae49fd06de782780a38e2914ed8cd8777 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 2 Nov 2014 12:29:27 +0100 Subject: Fix proc_getprocinfo calls The procinfoCnt argument is the number of elements of the procinfo_t array, not its size in bytes. * exec/elfcore.c (dump_core): Fix procinfoCnt given to proc_getprocinfo. * libps/procstat.c (merge_procinfo): Likewise. * utils/login.c (check_owned): Likewise. --- exec/elfcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'exec/elfcore.c') diff --git a/exec/elfcore.c b/exec/elfcore.c index 1f9238b6..033604c9 100644 --- a/exec/elfcore.c +++ b/exec/elfcore.c @@ -334,7 +334,7 @@ dump_core (task_t task, file_t file, off_t corelimit, mach_msg_type_number_t num_waits = 0; char pibuf[offsetof (struct procinfo, threadinfos[2])]; struct procinfo *pi = (void *) &pibuf; - mach_msg_type_number_t pi_size = sizeof pibuf; + mach_msg_type_number_t pi_size = sizeof pibuf / sizeof(*(procinfo_t*)0); memset (&pstatus.data, 0, sizeof pstatus.data); memset (&psinfo.data, 0, sizeof psinfo.data); -- cgit v1.2.3