From 4372cc956b7ff1b7e1398d2247e5ac87c4788455 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Mon, 26 Mar 2012 14:14:50 +0000 Subject: [PATCH] qual_syscall: fix potential NULL dereference Fix regression introduced by commit c1371ebc400fe9578908beca87f2bf407daf1506 * syscall.c (qual_syscall): Handle null sys_name. Reported-by: Fr. Br. George --- syscall.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/syscall.c b/syscall.c index cf9cd082..ddc461c7 100644 --- a/syscall.c +++ b/syscall.c @@ -345,14 +345,16 @@ qual_syscall(const char *s, int bitflag, int not) return 0; } for (i = 0; i < nsyscalls0; i++) - if (strcmp(s, sysent0[i].sys_name) == 0) { + if (sysent0[i].sys_name && + strcmp(s, sysent0[i].sys_name) == 0) { qualify_one(i, bitflag, not, 0); rc = 0; } #if SUPPORTED_PERSONALITIES >= 2 for (i = 0; i < nsyscalls1; i++) - if (strcmp(s, sysent1[i].sys_name) == 0) { + if (sysent1[i].sys_name && + strcmp(s, sysent1[i].sys_name) == 0) { qualify_one(i, bitflag, not, 1); rc = 0; } @@ -360,7 +362,8 @@ qual_syscall(const char *s, int bitflag, int not) #if SUPPORTED_PERSONALITIES >= 3 for (i = 0; i < nsyscalls2; i++) - if (strcmp(s, sysent2[i].sys_name) == 0) { + if (sysent2[i].sys_name && + strcmp(s, sysent2[i].sys_name) == 0) { qualify_one(i, bitflag, not, 2); rc = 0; } -- 2.50.1