Project

General

Profile

Actions

Bug #891

closed

off-by-one bug in truss

Added by nthery almost 17 years ago. Updated almost 17 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

truss cores dump while handling a syscall that is one past the last
syscall known to it. This happens typically after adding a new
syscall to the kernel and before rebuilding truss.

The following patch fixes this.

Index: dfly/src/usr.bin/truss/i386-fbsd.c ===================================================================
--- dfly.orig/src/usr.bin/truss/i386-fbsd.c 2003-11-04 16:34:41.000000000 0100
++ dfly/src/usr.bin/truss/i386-fbsd.c 2007-12-20 18:30:30.000000000 +0100
@ -157,7 +157,7 @ ===================================================================
--- dfly.orig/src/usr.bin/truss/i386-linux.c 2003-11-04 16:34:41.000000000 0100
++ dfly/src/usr.bin/truss/i386-linux.c 2007-12-20 18:31:19.000000000 +0100
@ -116,7 +116,7 @

lsc.number = syscall;
lsc.name =
- (syscall < 0 || syscall > nsyscalls) ? NULL : linux_syscallnames[syscall];
+ (syscall < 0 || syscall >= nsyscalls) ? NULL : linux_syscallnames[syscall];
if (!lsc.name) {
fprintf (outfile, "-- UNKNOWN SYSCALL %d\n", syscall);
}
Actions

Also available in: Atom PDF