From: Dmitry V. Levin Date: Wed, 22 Aug 2007 21:43:30 +0000 (+0000) Subject: 2007-08-20 Dmitry V. Levin X-Git-Tag: v4.5.18~138 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c18c703b4873f9510b7820edf5ff239c83e34d69;p=strace 2007-08-20 Dmitry V. Levin * syscall.c (qual_syscall, qualify): Fix nsyscalls and MAX_QUALS misuse. Reported by Xiaoning Ding. --- diff --git a/ChangeLog b/ChangeLog index fe097747..d6ceff9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-08-20 Dmitry V. Levin + + * syscall.c (qual_syscall, qualify): Fix nsyscalls and MAX_QUALS misuse. + Reported by Xiaoning Ding. + 2007-08-06 Jan Kratochvil Roland McGrath diff --git a/syscall.c b/syscall.c index dabdd76f..1ee6ce19 100644 --- a/syscall.c +++ b/syscall.c @@ -324,18 +324,19 @@ qual_syscall(s, opt, not) if (isdigit((unsigned char)*s)) { int i = atoi(s); - if (i < 0 || i >= nsyscalls) + if (i < 0 || i >= MAX_QUALS) return -1; qualify_one(i, opt, not, -1); return 0; } - for (i = 0; i < nsyscalls; i++) { + for (i = 0; i < nsyscalls0; i++) if (strcmp(s, sysent0[i].sys_name) == 0) { qualify_one(i, opt, not, 0); rc = 0; } #if SUPPORTED_PERSONALITIES >= 2 + for (i = 0; i < nsyscalls1; i++) if (strcmp(s, sysent1[i].sys_name) == 0) { qualify_one(i, opt, not, 1); rc = 0; @@ -343,12 +344,13 @@ qual_syscall(s, opt, not) #endif /* SUPPORTED_PERSONALITIES >= 2 */ #if SUPPORTED_PERSONALITIES >= 3 + for (i = 0; i < nsyscalls2; i++) if (strcmp(s, sysent2[i].sys_name) == 0) { qualify_one(i, opt, not, 2); rc = 0; } #endif /* SUPPORTED_PERSONALITIES >= 3 */ - } + return rc; } @@ -466,20 +468,22 @@ char *s; } for (p = strtok(s, ","); p; p = strtok(NULL, ",")) { if (opt->bitflag == QUAL_TRACE && (n = lookup_class(p)) > 0) { - for (i = 0; i < MAX_QUALS; i++) { + for (i = 0; i < nsyscalls0; i++) if (sysent0[i].sys_flags & n) qualify_one(i, opt, not, 0); #if SUPPORTED_PERSONALITIES >= 2 + for (i = 0; i < nsyscalls1; i++) if (sysent1[i].sys_flags & n) qualify_one(i, opt, not, 1); #endif /* SUPPORTED_PERSONALITIES >= 2 */ #if SUPPORTED_PERSONALITIES >= 3 + for (i = 0; i < nsyscalls2; i++) if (sysent2[i].sys_flags & n) qualify_one(i, opt, not, 2); #endif /* SUPPORTED_PERSONALITIES >= 3 */ - } + continue; } if (opt->qualify(p, opt, not)) {