Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jun 2001 23:23:15 -0700
From:      Dima Dorfman <dima@unixfreak.org>
To:        ian j hart <ianjhart@freeloader.freeserve.co.uk>
Cc:        freebsd-ports@freebsd.org, jkh@freebsd.org
Subject:   Re: New INDEX 
Message-ID:  <20010622062315.6C42D3E28@bazooka.unixfreak.org>
In-Reply-To: <3B326B5F.C763F5F8@freeloader.freeserve.co.uk>; from ianjhart@freeloader.freeserve.co.uk on "Thu, 21 Jun 2001 22:47:11 %2B0100"

next in thread | previous in thread | raw e-mail | index | archive | help
ian j hart <ianjhart@freeloader.freeserve.co.uk> writes:
> /stand/sysinstall is core dumping on the new ports/INDEX (r 1.337). The
> previous revision is okay (r 1.336). This is using 4.3-RELEASE.

Basically what's happening is that some gnome ports have very large
lists of dependencies.  Sysinstall being the queen of fixed-size
buffers, it doesn't deal with this very well.  At least the buffer
which holds the entire line (index.c::index_parse::line) and the
buffer which holds the build dependencies (index.c::index_parse::junk)
are being overrun.  This causes stack corruption, which leads to the
seg fault you're seeing.

The attached patch should fix it.  I made the buffers larger than they
have to be so that this kind of situation won't happen again for a
while.  Ideally sysinstall would dynamically allocate these buffers;
well, no: ideally sysinstall would be replaced by something a bit more
modern :-).

					Dima Dorfman
					dima@unixfreak.org

Index: index.c
===================================================================
RCS file: /stl/src/FreeBSD/src/release/sysinstall/Attic/index.c,v
retrieving revision 1.80.2.10
diff -u -r1.80.2.10 index.c
--- index.c	2001/04/22 16:56:11	1.80.2.10
+++ index.c	2001/06/22 06:17:04
@@ -272,8 +272,8 @@
 int
 index_parse(FILE *fp, char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint, char *cats, char *rdeps)
 {
-    char line[2048];
-    char junk[511];
+    char line[10240];
+    char junk[2048];
     char *cp;
     int i;
 
@@ -299,7 +299,7 @@
 int
 index_read(FILE *fp, PkgNodePtr papa)
 {
-    char name[127], pathto[255], prefix[255], comment[255], descr[127], maint[127], cats[511], deps[1024];
+    char name[127], pathto[255], prefix[255], comment[255], descr[127], maint[127], cats[511], deps[2048];
     PkgNodePtr i;
 
     while (index_parse(fp, name, pathto, prefix, comment, descr, maint, cats, deps) != EOF) {

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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