AMD64 self build fail during building libmagic

Pyun YongHyeon pyunyh at gmail.com
Wed Aug 16 04:07:05 UTC 2006


On Wed, Aug 16, 2006 at 01:33:00AM +0900, takawata at jp.freebsd.org wrote:
 > Hi, I recently encountered build failure with libmagic
 > for this one month.
 > My investigating shows that intermediate executable 'mkmagic'
 > fails to detect the termination of some description of entries 
 > which is longer than expect.(According to contrib/file/file.h
 >  the length is MAXDESC=64.)
 > The following is a workaround for it. Is it known problem?
 > 

I also encountered the same issue during upgrade to latest CURRENT
on sparc64. mkmagic dumped core on sparc64.
I've mananged to track down the cause of failure and I've sent a
patch to obrien but got no reply yet.

-- 
Regards,
Pyun YongHyeon
-------------- next part --------------
Index: apprentice.c
===================================================================
RCS file: /home/ncvs/src/contrib/file/apprentice.c,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 apprentice.c
--- apprentice.c	21 Jun 2006 09:28:00 -0000	1.1.1.11
+++ apprentice.c	16 Aug 2006 04:05:26 -0000
@@ -892,8 +892,10 @@
 		m->nospflag = 1;
 	} else
 		m->nospflag = 0;
-	while ((m->desc[i++] = *l++) != '\0' && i < MAXDESC)
+	while ((m->desc[i++] = *l++) != '\0' && i < MAXDESC - 1)
 		/* NULLBODY */;
+	/* make sure to terminate the string */
+	m->desc[i] = '\0';
 
 	if (ms->flags & MAGIC_CHECK) {
 		if (!check_format(ms, m))


More information about the freebsd-current mailing list