Skip the syscall entry if the sys_func field is NULL

Avoid NULL dereference when there are holes in sysent tables.
It can happen with syscall (number, ...) and number is in those holes.
There are no targets with holey systent tables so far, but at least
one such a target, x32, is already on the horizon.

* defs.h (SCNO_IN_RANGE): Also check the sys_func field.
This commit is contained in:
H.J. Lu 2012-02-03 10:19:55 -08:00 committed by Dmitry V. Levin
parent d602542f16
commit e752bed4af

3
defs.h
View File

@ -780,7 +780,8 @@ extern unsigned nioctlents;
extern const char *const *signalent;
extern unsigned nsignals;
#define SCNO_IN_RANGE(scno) ((unsigned long)(scno) < nsyscalls)
#define SCNO_IN_RANGE(scno) \
((unsigned long)(scno) < nsyscalls && sysent[scno].sys_func)
#if HAVE_LONG_LONG