From nobody@FreeBSD.org  Fri Oct 27 01:51:29 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E2DDE16A415
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 27 Oct 2006 01:51:29 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id AC6EE43D58
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 27 Oct 2006 01:51:29 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k9R1pM03011669
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 27 Oct 2006 01:51:22 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k9R1pMb4011645;
	Fri, 27 Oct 2006 01:51:22 GMT
	(envelope-from nobody)
Message-Id: <200610270151.k9R1pMb4011645@www.freebsd.org>
Date: Fri, 27 Oct 2006 01:51:22 GMT
From: Ryoji Kanai<kanai@big.or.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Build error on contrib/file/magic
X-Send-Pr-Version: www-3.0

>Number:         104845
>Category:       bin
>Synopsis:       [patch] Build error on contrib/file/magic(5)
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    antoine
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 27 02:00:35 GMT 2006
>Closed-Date:    Sat Apr 19 09:05:31 UTC 2008
>Last-Modified:  Sat Apr 19 09:05:31 UTC 2008
>Originator:     Ryoji Kanai
>Release:        7.0-Current
>Organization:
-
>Environment:
FreeBSD unicorn 7.0-CURRENT FreeBSD 7.0-CURRENT #7: Fri May 26 23:01:24 PDT 2006     kanai@unicorn:/usr/obj/usr/src/sys/UNICORN  i386
>Description:
I can't build libmagic due to a bug in "magic" program. It seems to be a
overflow type bug and I always got a segmentation fault when I'm doing
"make buildworld". The problem is in contrib/file/apprentice.c.
>How-To-Repeat:
make buildworld

That's it. You should get a Segmentation fault. Is this only me?
>Fix:
I GDBed the magic program and found this. I'm not sure this is the right
way to fix it.

angelfish:file> diff -u apprentice.c.orig apprentice.c
--- apprentice.c.orig   Thu Oct 26 10:48:19 2006
+++ apprentice.c        Thu Oct 26 11:34:31 2006
@@ -894,6 +894,7 @@
                m->nospflag = 0;
        while ((m->desc[i++] = *l++) != '\0' && i < MAXDESC)
                /* NULLBODY */;
+       m->desc[MAXDESC - 1] = 0;
 
        if (ms->flags & MAGIC_CHECK) {
                if (!check_format(ms, m))

>Release-Note:
>Audit-Trail:

From: Kris Kennaway <kris@obsecurity.org>
To: Ryoji Kanai <kanai@big.or.jp>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/104845: Build error on contrib/file/magic
Date: Fri, 27 Oct 2006 00:38:42 -0400

 On Fri, Oct 27, 2006 at 01:51:22AM +0000, Ryoji Kanai wrote:
 
 > That's it. You should get a Segmentation fault. Is this only me?
 
 Maybe.  There was a segfault fix to this file 4 months ago, can you
 please confirm that you have it?
 
 > >Fix:
 > I GDBed the magic program and found this. I'm not sure this is the right way to fix it.
 
 You could also check with the authors.
 
 Kris

From: Ryoji Kanai <kanai@big.or.jp>
To: Kris Kennaway <kris@obsecurity.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/104845: Build error on contrib/file/magic
Date: Fri, 27 Oct 2006 12:58:45 -0700

 At Fri, 27 Oct 2006 00:38:42 -0400,
 Kris Kennaway wrote:
 
 > > That's it. You should get a Segmentation fault. Is this only me?
 > 
 > Maybe.  There was a segfault fix to this file 4 months ago, can you
 > please confirm that you have it?
 
 My fix is another problem. The problem exists even in the latest code.
 
 > > >Fix:
 > > I GDBed the magic program and found this. I'm not sure this is the right way to fix it.
 > 
 > You could also check with the authors.
 
 I talked with Christos Zoulas (maintainer). He said this was a bug
 and he fixed it. I hope new version will be released soon. Anyway, you
 can close this pr and set a "should update contrib/file to the next
 version" flag.
 
 Thanks!

From: Kris Kennaway <kris@obsecurity.org>
To: Ryoji Kanai <kanai@big.or.jp>
Cc: Kris Kennaway <kris@obsecurity.org>, freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/104845: Build error on contrib/file/magic
Date: Fri, 27 Oct 2006 16:42:58 -0400

 On Fri, Oct 27, 2006 at 12:58:45PM -0700, Ryoji Kanai wrote:
 > 
 > At Fri, 27 Oct 2006 00:38:42 -0400,
 > Kris Kennaway wrote:
 > 
 > > > That's it. You should get a Segmentation fault. Is this only me?
 > > 
 > > Maybe.  There was a segfault fix to this file 4 months ago, can you
 > > please confirm that you have it?
 > 
 > My fix is another problem. The problem exists even in the latest code.
 > 
 > > > >Fix:
 > > > I GDBed the magic program and found this. I'm not sure this is the right way to fix it.
 > > 
 > > You could also check with the authors.
 > 
 > I talked with Christos Zoulas (maintainer). He said this was a bug
 > and he fixed it. I hope new version will be released soon. Anyway, you
 > can close this pr and set a "should update contrib/file to the next
 > version" flag.
 
 Interesting, I wonder why others aren't seeing it.  Do you have
 nonstandard MALLOC_OPTIONS (or /etc/malloc.conf)?
 
 If Christos has imported the fix, we can also do a vendor import of
 just your patch into FreeBSD since it won't cause a divergence from
 vendor code.
 
 Kris

From: Ryoji Kanai <kanai@big.or.jp>
To: Kris Kennaway <kris@obsecurity.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/104845: Build error on contrib/file/magic
Date: Fri, 27 Oct 2006 17:29:42 -0700

 > Interesting, I wonder why others aren't seeing it.  Do you have
 > nonstandard MALLOC_OPTIONS (or /etc/malloc.conf)?
 
 Yeah, it's wired. I don't have malloc.conf and any MALLOC*
 options. But, check the code. This is a bug.
 
 > If Christos has imported the fix, we can also do a vendor import of
 > just your patch into FreeBSD since it won't cause a divergence from
 > vendor code.
 
 I think he has imported. I sent the same patch that I sent with this
 pr. And, he simply said 
 
 At Fri, 27 Oct 2006 10:57:58 -0400,
 Christos Zoulas wrote:
 
 > You are absolutely right; I just fixed it.
 > 
 > Thanks,
 > 
 > christos
 
 If you can import my patch, that would be great.
 
 -- Ryoji
State-Changed-From-To: open->feedback 
State-Changed-By: antoine 
State-Changed-When: Wed Mar 19 19:20:33 UTC 2008 
State-Changed-Why:  
Dear submitter, file version 4.23 has been imported in freebsd 
and merged to RELENG_7 and RELENG_6. 
Can you confirm it fixes your problem? 
Thanks. 


Responsible-Changed-From-To: freebsd-bugs->antoine 
Responsible-Changed-By: antoine 
Responsible-Changed-When: Wed Mar 19 19:20:33 UTC 2008 
Responsible-Changed-Why:  
Track. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104845 
State-Changed-From-To: feedback->closed 
State-Changed-By: antoine 
State-Changed-When: Sat Apr 19 09:04:50 UTC 2008 
State-Changed-Why:  
Close: I believe this is fixed + feedback timeout (1 month). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104845 
>Unformatted:
