Subject: Tripwire, NetBSD/Sparc
To: None <port-sparc@netbsd.org>
From: LeRoy C. Miller III <qball@ansic.net>
List: port-sparc
Date: 06/28/2000 20:00:29
Ok, for those interested. ;)
A list subscriber Brian emailed me an explanation to my problem with tripwire
seg fualting on NetBSD/Sparc, and I figured I would share it. :)
Brian's Explanation
On NetBSD, the st_size field of a statbuf is an off_t (ie: 64 bits).
The code in question is assuming it is a 32 bit quantity. The printf
as it stands will try to dereference the second half of the st_size
field on the stack as the string for the %s. Changing the %7d to
%7lld should help. It probably needs similar changes in other places
as well.
(void) printf(" %-9.9s %7d %s", owner, statbuf.st_size, a_time + 4);
from utils.c is the printf in question. changing it to %7lld works and it seems
to run without error (I have yet to run it seriously on a dir other than
/usr/local/etc (for testing)) I will finish up testing it, but it appears this
did the trick.
below is a quick diff -ub you can patch with.
Much thanks to brian for pointing this out to me. ;)
START
--- utils.c Mon Jul 25 12:23:16 1994
+++ /root/utils.c Thu Jun 29 16:24:07 2000
@@ -697,7 +697,7 @@
print_perm((uint32)statbuf.st_mode);
- (void) printf(" %-9.9s %7d %s", owner, statbuf.st_size,
+ (void) printf(" %-9.9s %7lld %s", owner, statbuf.st_size,
a_time + 4);
printf(" %s\n", name);
END
LeRoy C. Miller III
Network Administrator ANSIC Networks
Email: qball@ansic.net
Phone: 610-681-6504
Whois NIC: LM4772
http://www.ansic.net <not fully functional yet>