bin/104845: Build error on contrib/file/magic

Ryoji Kanai kanai at big.or.jp
Fri Oct 27 02:00:37 UTC 2006


>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 at 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:


More information about the freebsd-bugs mailing list