[PATCH 7/7] Skip the entry if the sys_func field is NULL

H.J. Lu hongjiu.lu at intel.com
Fri Feb 3 18:19:55 UTC 2012


Hi,

This patch avoids segfault when there are holes in system call table.
It can happen with syscall (number, ...) and number is in those holes.


H.J.
---
2012-02-03  H.J. Lu  <hongjiu.lu at intel.com>

	* defs.h (SCNO_IN_RANGE): Also check the sys_func field.

diff --git a/defs.h b/defs.h
index 8bcd34e..2f08511 100644
--- 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
 
-- 
1.7.6.5





More information about the Strace-devel mailing list