Correct off-by-one issue in truss(1) which happens when system call number

is nsyscalls.

PR:		bin/134916
Submitted by:	Steven Hartland <steven hartland multiplay co uk>
MFC after:	2 weeks
This commit is contained in:
delphij 2009-05-28 00:38:24 +00:00
parent 3d7b880e84
commit 1e64043f43
9 changed files with 9 additions and 9 deletions

View File

@ -142,7 +142,7 @@ amd64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
fsc.number = syscall_num;
fsc.name =
(syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
(syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : syscallnames[syscall_num];
if (!fsc.name) {
fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
}

View File

@ -152,7 +152,7 @@ amd64_fbsd32_syscall_entry(struct trussinfo *trussinfo, int nargs) {
fsc.number = syscall_num;
fsc.name =
(syscall_num < 0 || syscall_num > nsyscalls) ? NULL :
(syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
freebsd32_syscallnames[syscall_num];
if (!fsc.name) {
fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);

View File

@ -124,7 +124,7 @@ amd64_linux32_syscall_entry(struct trussinfo *trussinfo, int nargs) {
fsc.number = syscall_num;
fsc.name =
(syscall_num < 0 || syscall_num > nsyscalls) ? NULL : linux32_syscallnames[syscall_num];
(syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : linux32_syscallnames[syscall_num];
if (!fsc.name) {
fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
}

View File

@ -147,7 +147,7 @@ i386_syscall_entry(struct trussinfo *trussinfo, int nargs) {
fsc.number = syscall_num;
fsc.name =
(syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
(syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : syscallnames[syscall_num];
if (!fsc.name) {
fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
}

View File

@ -124,7 +124,7 @@ i386_linux_syscall_entry(struct trussinfo *trussinfo, int nargs) {
fsc.number = syscall_num;
fsc.name =
(syscall_num < 0 || syscall_num > nsyscalls) ? NULL : linux_syscallnames[syscall_num];
(syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : linux_syscallnames[syscall_num];
if (!fsc.name) {
fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
}

View File

@ -135,7 +135,7 @@ ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
syscall_num = (int)*parm_offset++;
fsc.number = syscall_num;
fsc.name = (syscall_num < 0 || syscall_num > nsyscalls)
fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls)
? NULL : syscallnames[syscall_num];
if (!fsc.name) {
fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);

View File

@ -139,7 +139,7 @@ mips_syscall_entry(struct trussinfo *trussinfo, int nargs) {
fsc.number = syscall_num;
fsc.name =
(syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
(syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : syscallnames[syscall_num];
if (!fsc.name) {
fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
}

View File

@ -149,7 +149,7 @@ powerpc_syscall_entry(struct trussinfo *trussinfo, int nargs) {
fsc.number = syscall_num;
fsc.name =
(syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
(syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : syscallnames[syscall_num];
if (!fsc.name) {
fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
}

View File

@ -145,7 +145,7 @@ sparc64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
fsc.number = syscall_num;
fsc.name =
(syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
(syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : syscallnames[syscall_num];
if (!fsc.name) {
fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
}