]> granicus.if.org Git - strace/commitdiff
Skip the syscall entry if the sys_func field is NULL
authorH.J. Lu <hongjiu.lu@intel.com>
Fri, 3 Feb 2012 18:19:55 +0000 (10:19 -0800)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 6 Feb 2012 16:33:26 +0000 (16:33 +0000)
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.

defs.h

diff --git a/defs.h b/defs.h
index 8bcd34e0e9c402043d6fb46103e1690be02e0d61..2f085119abfb860ef80bd561a32d97ee724d35cc 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -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