Obey sv_syscallnames bounds in syscallname().

Reported and tested by:	pho
This commit is contained in:
kib 2010-07-04 18:16:17 +00:00
parent 5758b8c344
commit 4de7ec3dbb

View File

@ -245,10 +245,12 @@ const char *
syscallname(struct proc *p, u_int code) syscallname(struct proc *p, u_int code)
{ {
static const char unknown[] = "unknown"; static const char unknown[] = "unknown";
struct sysentvec *sv;
if (p->p_sysent->sv_syscallnames == NULL) sv = p->p_sysent;
if (sv->sv_syscallnames == NULL || code >= sv->sv_size)
return (unknown); return (unknown);
return (p->p_sysent->sv_syscallnames[code]); return (sv->sv_syscallnames[code]);
} }
int int