Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site l5.uucp Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!lll-crg!dual!ptsfa!l5!gnu From: gnu@l5.uucp (John Gilmore) Newsgroups: net.bugs,net.news.b Subject: Re: readnews (2.10.3 4.3bsd-beta 6/6/85) bug fix Message-ID: <276@l5.uucp> Date: Fri, 22-Nov-85 17:04:19 EST Article-I.D.: l5.276 Posted: Fri Nov 22 17:04:19 1985 Date-Received: Sun, 24-Nov-85 07:24:40 EST References: <102@delftcc.UUCP> Organization: Nebula Consultants in San Francisco Lines: 72 Xref: watmath net.bugs:721 net.news.b:1266 In article <102@delftcc.UUCP>, sam@delftcc.UUCP (Sam Kendall) writes: > I recently rmgroup'd locally a bunch of obsolete newsgroups and added a > bunch of new ones to "active". After this, readnews dumped core. > rfuncs.c, line 569: > if (lentab[i] == len && strncmp(name, rcline[i], len) == 0) Here is the fix. I sent it back to be included in the next news release. The problem is that rcline[i] gets freed but lentab[i] still claims that the line exists. The fix makes lentab[] public so we can fix it, and zeros the relevant entry so it won't compare equal in the above line. The problem occurs if either you put the same newsgroup twice in .newsrc, or if a newsgroup from .newsrc doesn't exist in the active file. *** /tmp/geta15917 Fri Nov 22 13:57:26 1985 --- rfuncs.c Fri Nov 22 13:57:27 1985 *************** *** 10,15 #include "rparams.h" long nngsize; /* The next upcoming value of ngsize. */ long nminartno; /* Smallest article number in this group */ int BITMAPSIZE = 0; --- 10,17 ----- #include "rparams.h" + char lentab[LINES]; /* Length of newsgroup name for each rcline */ + long nngsize; /* The next upcoming value of ngsize. */ long nminartno; /* Smallest article number in this group */ int BITMAPSIZE = 0; *************** *** 553,559 register int top; register int len; static int prev; - static char lentab[LINES]; static int didthru; for ( ; didthru <= line; ++didthru) --- 555,560 ----- register int top; register int len; static int prev; static int didthru; for ( ; didthru <= line; ++didthru) *************** *** 685,690 /* copy active to newactive, in the new order */ for (i = 0; i < nlines; i++) { while (++lastline < tp->rcindex) { free(rcline[lastline]); rcline[lastline] = NULL; } --- 686,695 ----- /* copy active to newactive, in the new order */ for (i = 0; i < nlines; i++) { while (++lastline < tp->rcindex) { + fprintf(stderr, + "Dup .newsrc line or bad newsgroup: %s\n", + rcline[lastline]); + lentab[lastline] = 0; free(rcline[lastline]); rcline[lastline] = NULL; }