Fix NULL dereference in "-S name" when syscall table has holes

* count.c (syscall_cmp): Do not pass NULL to strcmp.
This commit is contained in:
Дмитрий Левин 2016-05-10 00:16:20 +00:00
parent 804bb8797b
commit fa925dce70

View File

@ -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