The memset() in the PROC_LOOSE_TASKS loop leaves a struct proc_t
uninitialized (the one at data+n_used), which leads to a use-after-free.
ps calls readproctab2(), but only if !TF_loose_tasks, and this U-A-F is
triggered only if PROC_LOOSE_TASKS, so there seems to be no vulnerable
call in the procps package itself (other users of the libprocps may be
vulnerable, though).
data = xrealloc(data,sizeof(proc_t)*n_alloc);
// have to move tmp too
tmp = data+(tmp-old);
- memset(data+n_used+1, 0, sizeof(proc_t)*(n_alloc-(n_used+1)));
+ memset(data+n_used, 0, sizeof(proc_t)*(n_alloc-n_used));
}
if(n_task_alloc == n_task){
//proc_t **old = ttab;