readnews (2.10.3 4.3bsd-beta 6/6/85) bug fix
John Gilmore
gnu at l5.uucp
Sat Nov 23 08:04:19 AEST 1985
In article <102 at delftcc.UUCP>, sam at 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;
}
More information about the Net.bugs
mailing list