Subject: bin/1020: file /etc/csh.cshrc dumps core
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Arne Henrik Juul <arnej@imf.unit.no>
List: netbsd-bugs
Date: 05/05/1995 08:35:03
>Number:         1020
>Category:       bin
>Synopsis:       bug in 'file' causes core dump in some rare cases
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May  5 08:35:02 1995
>Originator:     Arne H. Juul
>Organization:
	University of Trondheim, Norway
>Release:        NetBSD-current Fri May 5, 1995
>Environment:
	Observed on i386 platform.
	Should probably be seen elsewhere too.
System: NetBSD rtfm.imf.unit.no 1.0A NetBSD 1.0A (RTFM) #0: Thu May 4 18:37:09 MET DST 1995 root@rtfm.imf.unit.no:/usr/src/sys/arch/i386/compile/RTFM i386

>Description:
	Stack smash bug. Took a bit of time to find, too :-(
	I think /etc/csh.cshrc triggers it mainly because it's 38 bytes long.
>How-To-Repeat:
	file /etc/csh.cshrc
>Fix:
	Apply this patch:
--- softmagic.c	Tue May  2 12:05:22 1995
+++ softmagic.c.mine	Fri May  5 17:11:46 1995
@@ -298,7 +298,7 @@
 		else
 			have = 0;
 
-		memset(p + have, 0, sizeof(union VALUETYPE) - have);
+		memset((char *)p + have, 0, sizeof(union VALUETYPE) - have);
 	}
 
 
>Audit-Trail:
>Unformatted: