pag@hao.UUCP (Peter Gross) (11/29/84)
I replied to an article that had lots of References and noticed that the constructed header was trashed. The problem turned out to be that not enough space (BUFLEN [128 on a PDP-11] chars) was allocated to hold the followups (in readr.c). The header definition of followups should probably also be increased. Diffs follow: *** /tmp/,RCSt1010408 Wed Nov 28 23:45:03 1984 --- readr.c Wed Nov 28 23:42:54 1984 *************** *** 2,7 * readr - /bin/mail and msgs interface and associated functions. * * $Log: readr.c,v $ * Revision 2.48 84/11/28 23:33:36 pag * Added Bill Sebok's NETPATH (path optimization) code * --- 2,11 ----- * readr - /bin/mail and msgs interface and associated functions. * * $Log: readr.c,v $ + * Revision 2.49 84/11/28 23:41:26 pag + * Bug fix: replies to articles with lots of References overflowed + * the local array. Increased the size of folbuf. + * * Revision 2.48 84/11/28 23:33:36 pag * Added Bill Sebok's NETPATH (path optimization) code * *************** *** 11,17 */ #ifndef lint ! static char *RcsId = "$Header: readr.c,v 2.48 84/11/28 23:33:36 pag Exp $"; #endif !lint #include "rparams.h" --- 15,21 ----- */ #ifndef lint ! static char *RcsId = "$Header: readr.c,v 2.49 84/11/28 23:41:26 pag Exp $"; #endif !lint #include "rparams.h" *************** *** 626,632 FILE *tfp; char *replyname(); char subj[BUFLEN]; ! char folbuf[BUFLEN]; struct stat statb; long creatm; #ifdef NETPATHS --- 630,636 ----- FILE *tfp; char *replyname(); char subj[BUFLEN]; ! char folbuf[2*BUFLEN]; struct stat statb; long creatm; #ifdef NETPATHS
rees@apollo.uucp (Jim Rees) (12/07/84)
readr.c: *************** *** 626,632 ! char folbuf[BUFLEN]; --- 630,636 ----- ! char folbuf[2*BUFLEN]; I don't like the idea of just growing this line forever. For one thing, there are other buffers elsewhere (in header.c, for example) that will still be too small. The approach I took was to impose an upper limit on the length of the references line. My limit is about 80, which is within the limit of 100 that news 2.10.1 will allow, but you can make it whatever you want. Here is my patch to readr.c: *************** *** 609,615 { register char *pathptr; int edit = 1; ! char *ed; FILE *tfp; char *replyname(); char subj[BUFLEN]; --- 613,619 ----- { register char *pathptr; int edit = 1; ! char *ed, *fbp; FILE *tfp; char *replyname(); char subj[BUFLEN]; *************** *** 658,665 folbuf[0] = '\0'; /* References */ if (hptr->followid[0]) { ! strcpy(folbuf, hptr->followid); ! strcat(folbuf, ", "); } strcat(folbuf, hptr->ident); --- 662,676 ----- folbuf[0] = '\0'; /* References */ if (hptr->followid[0]) { ! fbp = hptr->followid; ! ! /* If the references line is too long, truncate it. */ ! while (fbp && strlen(fbp) > 80) ! fbp = index(fbp + 1, '<'); ! if (fbp != NULL) { ! strcpy(folbuf, fbp); ! strcat(folbuf, " "); ! } } strcat(folbuf, hptr->ident);