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...
This commit is contained in:
Ken Smith 2007-12-24 00:43:11 +00:00
parent 05a824e9fa
commit 4f0cddb625

View File

@ -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 {