Date: Thu, 11 Feb 1999 14:49:08 +0100 (CET) From: arnej@math.ntnu.no To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/10027: kdump prints garbage when command name is too long Message-ID: <199902111349.OAA51855@fimfpc19.math.ntnu.no>
next in thread | raw e-mail | index | archive | help
>Number: 10027 >Category: bin >Synopsis: kdump prints garbage when command name is too long >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Feb 11 05:50:00 PST 1999 >Closed-Date: >Last-Modified: >Originator: Arne Henrik Juul >Release: FreeBSD 3.0-STABLE i386 >Organization: Norwegian University of Technology and Science >Environment: This looks like a bug that is present in all versions of kdump.c. >Description: When kdump writes the command name, it does not take care to only write the bytes that actually belong to that field, so it also writes the binary data in following fields until it hits a terminating zero somewhere. >How-To-Repeat: cd /tmp cp /bin/ls ls-with-a-very-long-name ktrace ./ls-with-a-very-long-name ls-with-a-very-long-name kdump [... typical result ...] 51810 ls-with-a-very-lnameÐÞÂ6Înb RET write 25/0x19 51810 ls-with-a-very-lnameÐÞÂ6bob CALL fchdir(0x3) 51810 ls-with-a-very-lnameÐÞÂ67ob RET fchdir 0 51810 ls-with-a-very-lnameÐÞÂ6ob CALL madvise(0x807f000,0x1000,0x5) 51810 ls-with-a-very-lnameÐÞÂ6×ob RET madvise 0 51810 ls-with-a-very-lnameÐÞÂ6tpb CALL exit(0) >Fix: Apply this patch: Index: kdump.c =================================================================== RCS file: /usr/cvs/src/usr.bin/kdump/kdump.c,v retrieving revision 1.11 diff -u -r1.11 kdump.c --- kdump.c 1997/07/16 06:49:49 1.11 +++ kdump.c 1999/02/05 13:18:55 @@ -211,7 +211,7 @@ type = unknown; } - (void)printf("%6d %-8s ", kth->ktr_pid, kth->ktr_comm); + (void)printf("%6d %-8.*s ", kth->ktr_pid, MAXCOMLEN, kth->ktr_comm); if (timestamp) { if (timestamp == 2) { temp = kth->ktr_time; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902111349.OAA51855>