Fix NULL dereference in "-S name" when syscall table has holes
* count.c (syscall_cmp): Do not pass NULL to strcmp.
diff --git a/count.c b/count.c
index 4b16ee6..1393b6e 100644
--- a/count.c
+++ b/count.c
@@ -112,8 +112,9 @@
static int
syscall_cmp(void *a, void *b)
{
- return strcmp(sysent[*((int *) a)].sys_name,
- sysent[*((int *) b)].sys_name);
+ const char *a_name = sysent[*((int *) a)].sys_name;
+ const char *b_name = sysent[*((int *) b)].sys_name;
+ return strcmp(a_name ? a_name : "", b_name ? b_name : "");
}
static int