From: Dmitry V. Levin Date: Mon, 26 Mar 2012 14:14:50 +0000 (+0000) Subject: qual_syscall: fix potential NULL dereference X-Git-Tag: v4.7~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4372cc956b7ff1b7e1398d2247e5ac87c4788455;p=strace 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 --- 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; }