From fa925dce70d1c3715b432592fd650374f5bf7284 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 10 May 2016 00:16:20 +0000 Subject: [PATCH] Fix NULL dereference in "-S name" when syscall table has holes * count.c (syscall_cmp): Do not pass NULL to strcmp. --- count.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/count.c b/count.c index 4b16ee66..1393b6e4 100644 --- a/count.c +++ b/count.c @@ -112,8 +112,9 @@ time_cmp(void *a, void *b) 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