matthew@sunpix.East.Sun.COM ( Sun Visualization Products) (06/06/90)
After having two mail messages, which were for an internal newgroup, end up in newgroup "general", I set out to find the problem. What I found I would classify as 'Once in a blue moon problem'. What was happening, was that any message ending in a double quote ended up in the "general" newgroup. Why? Because a bug in the pipeopen() function would cause the uncontested coping of the next two characters after a backslash, not just the next one. The cure? The simple removal of one of the copy statements (line 395). During my analysis of the problem, I also noticed that backslashes were being properly protected. That fixed required slight changes to lines 161, 176, and 313. Below is a short patch to recnews. #ifdef SCCSID static char *SccsId = "@(#)recnews.c 2.20 1/17/89"; #endif /* SCCSID */ *** recnews.c.orig Wed Jun 6 09:00:20 1990 --- recnews.c Wed Jun 6 09:06:17 1990 *************** *** 158,164 **** p = buf + 8; q = subject; while (*++p) { ! if (*p == '"') *q++ = '\\'; *q++ = *p; } --- 158,164 ---- p = buf + 8; q = subject; while (*++p) { ! if (*p == '"' || *p == '\\') *q++ = '\\'; *q++ = *p; } *************** *** 173,179 **** p = buf + 3; q = to; while (*++p) { ! if (*p == '"') *q++ = '\\'; *q++ = *p; } --- 173,179 ---- p = buf + 3; q = to; while (*++p) { ! if (*p == '"' || *p == '\\') *q++ = '\\'; *q++ = *p; } *************** *** 310,316 **** p = buf + 4; q = fbuf; while (*++p) { ! if (*p == '"') *q++ = '\\'; *q++ = *p; } --- 310,316 ---- p = buf + 4; q = fbuf; while (*++p) { ! if (*p == '"' || *p == '\\') *q++ = '\\'; *q++ = *p; } *************** *** 392,398 **** while (*cmd) { if(*cmd == '\\') { cmd++; - *bcp++ = *cmd++; } else if (*cmd == '"') break; *bcp++ = *cmd++; --- 392,397 ---- -- Matthew Lee Stier | Sun Microsystems --- RTP, NC 27709-3447 | "Wisconsin Escapee" uucp: sun!mstier or mcnc!rti!sunpix!matthew | phone: (919) 469-8300 fax: (919) 460-8355 |