]> granicus.if.org Git - strace/commitdiff
qual_syscall: fix potential NULL dereference
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Mar 2012 14:14:50 +0000 (14:14 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Mar 2012 14:14:50 +0000 (14:14 +0000)
Fix regression introduced by commit
c1371ebc400fe9578908beca87f2bf407daf1506

* syscall.c (qual_syscall): Handle null sys_name.

Reported-by: Fr. Br. George <george@altlinux.org>
syscall.c

index cf9cd0820754e3885f2a826f662cbcae13c8c029..ddc461c78db244f0cfc056b583e84919aa69ce24 100644 (file)
--- 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;
                }