Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Oct 2006 01:51:22 GMT
From:      Ryoji Kanai<kanai@big.or.jp>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/104845: Build error on contrib/file/magic
Message-ID:  <200610270151.k9R1pMb4011645@www.freebsd.org>
Resent-Message-ID: <200610270200.k9R20aGW046494@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         104845
>Category:       bin
>Synopsis:       Build error on contrib/file/magic
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 27 02:00:35 GMT 2006
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610270151.k9R1pMb4011645>