Bug 83602

Summary: net/mpd causes segmentation fault with amd64 architecture.
Product: Ports & Packages Reporter: Yoshisato Yanagisawa <osho>
Component: Individual Port(s)Assignee: Archie Cobbs <archie>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Yoshisato Yanagisawa 2005-07-17 14:00:24 UTC
	Mpd, a famous program to realize kernel-level PPP(oE) connection,
	stops with segmentation fault when used on an amd64 architecture
	machine.  This segmentation fault is caused by misuse of va_list
	mechanism.

Fix: Use following patches (archived with shar).


Note:
	Those patches are released by James R. Van Artsalen at:
	http://lists.freebsd.org/pipermail/freebsd-amd64/2004-December/003094.html
	However, we need the patches above until new mpd, which include them,
	is released.--x0gGKj7J3vXV81OWqG5yn2ueYHmdnhPO5nNl896nmWajAng1
Content-Type: text/plain; name="file.shar"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.shar"

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	files/patch-src::custom.c
#	files/patch-src::log.c
#	files/patch-src::modem.c
#
echo x - files/patch-src::custom.c
sed 's/^X//' >files/patch-src::custom.c << 'END-of-files/patch-src::custom.c'
X--- src/custom.c.orig	Sun Jul 17 19:48:59 2005
X+++ src/custom.c	Sun Jul 17 19:49:27 2005
X@@ -141,16 +141,19 @@
X   if (!bund)
X     return;
X 
X-  va_start(args, fmt);
X   if (l == NULL) {
X     for (k = 0; k < bund->n_links; k++) {
X-      if (bund && bund->links[k])
X+      if (bund && bund->links[k]) {
X+	va_start(args, fmt);
X 	RecordLinkUpDownReason2(bund->links[k], up, key, fmt, args);
X+	va_end(args);
X+      }
X     }
X   } else {
X+    va_start(args, fmt);
X     RecordLinkUpDownReason2(l, up, key, fmt, args);
X+    va_end(args);
X   }
X-  va_end(args);
X }
X 
X static void
END-of-files/patch-src::custom.c
echo x - files/patch-src::log.c
sed 's/^X//' >files/patch-src::log.c << 'END-of-files/patch-src::log.c'
X--- src/log.c.orig	Sun Jul 17 19:48:59 2005
X+++ src/log.c		Sun Jul 17 19:49:27 2005
X@@ -265,17 +265,21 @@
X {
X   va_list	args;
X 
X-  va_start(args, fmt);
X   LogTimeStamp(logprintf);
X+  va_start(args, fmt);
X   vlogprintf(fmt, args);
X+  va_end(args);
X+  va_start(args, fmt);
X   vlogprintf("\n", args);		/* XXX args will be ignored */
X+  va_end(args);
X   if (gLogOptions & LG_CONSOLE)
X   {
X+    va_start(args, fmt);
X     vfprintf(stdout, fmt, args);
X+    va_end(args);
X     putc('\n', stdout);
X     fflush(stdout);
X   }
X-  va_end(args);
X }
X 
X /*
X@@ -315,12 +319,16 @@
X 
X /* Dump it */
X 
X-  va_start(ap, fmt);
X-  if (console)
X+  if (console) {
X+    va_start(ap, fmt);
X     LogDoDumpBp(printf, vprintf, FALSE, bp, fmt, ap);
X-  if (log)
X+    va_end(ap);
X+  }
X+  if (log) {
X+    va_start(ap, fmt);
X     LogDoDumpBp(logprintf, vlogprintf, TRUE, bp, fmt, ap);
X-  va_end(ap);
X+    va_end(ap);
X+  }
X }
X 
X /*
X@@ -342,11 +350,16 @@
X 
X /* Dump it */
X 
X-  va_start(ap, fmt);
X-  if (console)
X+  if (console) {
X+    va_start(ap, fmt);
X     LogDoDumpBuf(printf, vprintf, FALSE, buf, count, fmt, ap);
X-  if (log)
X+    va_end(ap);
X+  }
X+  if (log) {
X+    va_start(ap, fmt);
X     LogDoDumpBuf(logprintf, vlogprintf, TRUE, buf, count, fmt, ap);
X+    va_end(ap);
X+  }
X }
X 
X /*
END-of-files/patch-src::log.c
echo x - files/patch-src::modem.c
sed 's/^X//' >files/patch-src::modem.c << 'END-of-files/patch-src::modem.c'
X--- src/modem.c.orig	Sun Jul 17 19:48:59 2005
X+++ src/modem.c		Sun Jul 17 19:49:27 2005
X@@ -610,10 +610,12 @@
X   /* Concat prefix and message */
X   va_start(args, fmt);
X   vsnprintf(buf, sizeof(buf), fmt, args);
X+  va_end(args);
X   if (*buf != ' ')
X     snprintf(buf, sizeof(buf), "[%s] chat: ", lnk->name);
X   else
X     *buf = '\0';
X+  va_start(args, fmt);
X   vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), fmt, args);
X   va_end(args);
X 
END-of-files/patch-src::modem.c
exit
How-To-Repeat: 	Just install net/mpd-3.18 from ports collection and run it on an
	amd64 architecture machine.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2005-07-17 19:08:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->archie

Over to maintainer.
Comment 2 Archie Cobbs freebsd_committer freebsd_triage 2005-10-01 21:08:13 UTC
State Changed
From-To: open->closed

Patch applied.