From 4f0cddb625481d630c99ee3d8eab0f8797bb2a12 Mon Sep 17 00:00:00 2001 From: Ken Smith Date: Mon, 24 Dec 2007 00:43:11 +0000 Subject: [PATCH] For the INDEX file to be used on disc1 of the 7.0-RELEASE the longest "build dependencies" field is 5,108 characters which overflows the length of the junk buffer by a teeny bit. This whole section needs much more error checking but for now just completely ignore stuff we have no interest in instead of copying it to someplace we don't use in the process. Insta-MFC probably coming since this is holding up 7.0-RC1... --- usr.sbin/sysinstall/index.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/usr.sbin/sysinstall/index.c b/usr.sbin/sysinstall/index.c index 1dd7913ad957..7a9443a73da4 100644 --- a/usr.sbin/sysinstall/index.c +++ b/usr.sbin/sysinstall/index.c @@ -269,6 +269,18 @@ copy_to_sep(char *to, char *from, int sep) return tok + 1 - from; } +static int +skip_to_sep(char *from, int sep) +{ + char *tok; + + tok = strchr(from, sep); + if (!tok) + return 0; + *tok = '\0'; + return tok + 1 - from; +} + static int readline(FILE *fp, char *buf, int max) { @@ -307,21 +319,21 @@ index_parse(FILE *fp, char *name, char *pathto, char *prefix, char *comment, cha cp += copy_to_sep(descr, cp, '|'); /* path to pkg-descr */ cp += copy_to_sep(maint, cp, '|'); /* maintainer */ cp += copy_to_sep(cats, cp, '|'); /* categories */ - cp += copy_to_sep(junk, cp, '|'); /* build deps - not used */ + cp += skip_to_sep(cp, '|'); /* build deps - not used */ cp += copy_to_sep(rdeps, cp, '|'); /* run deps */ if (index(cp, '|')) - cp += copy_to_sep(junk, cp, '|'); /* url - not used */ + cp += skip_to_sep(cp, '|'); /* url - not used */ else { strncpy(junk, cp, 1023); *volume = 0; return 0; } if (index(cp, '|')) - cp += copy_to_sep(junk, cp, '|'); /* extract deps - not used */ + cp += skip_to_sep(cp, '|'); /* extract deps - not used */ if (index(cp, '|')) - cp += copy_to_sep(junk, cp, '|'); /* patch deps - not used */ + cp += skip_to_sep(cp, '|'); /* patch deps - not used */ if (index(cp, '|')) - cp += copy_to_sep(junk, cp, '|'); /* fetch deps - not used */ + cp += skip_to_sep(cp, '|'); /* fetch deps - not used */ if (index(cp, '|')) cp += copy_to_sep(volstr, cp, '|'); /* media volume */ else {