rees@apollo.uucp (Jim Rees) (04/27/84)
You probably thought, because the numbers in /usr/lib/active
can go up to 99999, that the largest ngsize is 99999. Wrong.
The largest ngsize is 8192 and is hard-coded. Worse, there is
no check that this number isn't exceeded. We recently exceeded it,
and the symptoms included very long lines in .newsrc like this:
net.micro: 1-8193,8196-8204,8208-8212,8226-8230,...
and also infinite loops in updaterc().
The best fix would be to use some other kind of data structure, or
don't always start the bitmap at 1, but I took the easy way out
and turned the bitmap size into a parameter then increased it.
This approach may not work on limited address space machines,
like pdp-11s.
Here are the fixes. I don't know of any reason why BITMAPSIZE needs
to be a power of 2, but I left it that way just in case. Note that
I didn't fix the real bug, which is that the limit is never checked.
Add this line to defs.h:
#define BITMAPSIZE 32768 /* Size of bitmap for readnews; was hardcoded 8192 */
In rextern.c:
***************
*** 73,79
FILE *rcfp, *actfp;
time_t atime;
char newsrc[BUFLEN], groupdir[BUFLEN], *rcline[LINES], rcbuf[LBUFLEN];
! char bitmap[1024], *argvrc[LINES];
int bit, obit, readmode = NEXT;
int defexp = FALSE; /* set if def. expiration date used */
int actdirect = FORWARD; /* read direction in ACTIVE file */
--- 73,79 -----
FILE *rcfp, *actfp;
time_t atime;
char newsrc[BUFLEN], groupdir[BUFLEN], *rcline[LINES], rcbuf[LBUFLEN];
! char bitmap[BITMAPSIZE / 8], *argvrc[LINES];
int bit, obit, readmode = NEXT;
int defexp = FALSE; /* set if def. expiration date used */
int actdirect = FORWARD; /* read direction in ACTIVE file */
In rfuncs.c:
***************
*** 300,306
while (!(get(next)) && next <= ngsize)
next++;
if (cur == next) {
! next = 8193;
goto skip;
}
if (cur + 1 == next)
--- 299,305 -----
while (!(get(next)) && next <= ngsize)
next++;
if (cur == next) {
! next = BITMAPSIZE + 1;
goto skip;
}
if (cur + 1 == next)