You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two calloc() calls that are not checked for NULL returns, the following memcpy/memset calls will trigger segmentation faults on the null pointers of proc_stat_prev and proc_stat_cur if calloc fails.
static int parse_proc_stat(void)
{
FILE *filep;
int i;
int val;
int count = get_max_online_cpu() + 1;
int sys_idx = count - 1;
int size = sizeof(struct proc_stat_info) * count;
filep = fopen (PATH_PROC_STAT, "r");
if (!filep)
return 1;
if (!proc_stat_prev)
proc_stat_prev = calloc(sizeof(struct proc_stat_info), count);
if (!proc_stat_cur)
proc_stat_cur = calloc(sizeof(struct proc_stat_info), count);
memcpy (proc_stat_prev, proc_stat_cur, size);
memset (proc_stat_cur, 0, size);
The text was updated successfully, but these errors were encountered:
There are two calloc() calls that are not checked for NULL returns, the following memcpy/memset calls will trigger segmentation faults on the null pointers of proc_stat_prev and proc_stat_cur if calloc fails.
The text was updated successfully, but these errors were encountered: