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. --- libps/procstat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libps') diff --git a/libps/procstat.c b/libps/procstat.c index 0d4a565b..b00c9e41 100644 --- a/libps/procstat.c +++ b/libps/procstat.c @@ -192,7 +192,7 @@ merge_procinfo (struct proc_stat *ps, ps_flags_t need, ps_flags_t have) return ENOMEM; } new_pi = ps->proc_info; - new_pi_size = ps->proc_info_size; + new_pi_size = ps->proc_info_size / sizeof(*(procinfo_t)0); if (really_need & PSTAT_THREAD_WAITS) /* We're going to get thread waits info, so make some storage for it too.*/ @@ -240,7 +240,7 @@ merge_procinfo (struct proc_stat *ps, ps_flags_t need, ps_flags_t have) else free (ps->proc_info); ps->proc_info = new_pi; - ps->proc_info_size = new_pi_size; + ps->proc_info_size = new_pi_size * sizeof(*(procinfo_t)0); ps->proc_info_vm_alloced = 1; } -- cgit v1.2.3