top: one sanity check endpoint->slot number
This commit is contained in:
parent
67c2d2fa54
commit
fa0fe45103
@ -88,6 +88,7 @@ void parse_file(pid_t pid)
|
|||||||
unsigned long cycles_hi, cycles_lo;
|
unsigned long cycles_hi, cycles_lo;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
|
int slot;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sprintf(path, "%d/psinfo", pid);
|
sprintf(path, "%d/psinfo", pid);
|
||||||
@ -110,7 +111,15 @@ void parse_file(pid_t pid)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = &proc[SLOT_NR(endpt)];
|
slot = SLOT_NR(endpt);
|
||||||
|
|
||||||
|
if(slot < 0 || slot >= nr_total) {
|
||||||
|
fprintf(stderr, "top: unreasonable endpoint number %d\n", endpt);
|
||||||
|
fclose(fp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = &proc[slot];
|
||||||
|
|
||||||
if (type == TYPE_TASK)
|
if (type == TYPE_TASK)
|
||||||
p->p_flags |= IS_TASK;
|
p->p_flags |= IS_TASK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user