postnews() bug (2.10.3), with fix

Skip to first unread message

der Mouse

Aug 13, 1986, 11:56:13 PM8/13/86
There is a bug in 2.10.3 postnews that causes (some) moderated group
postings to be sent to inews directly, which results in their rejection
due to "unapproved moderated newsgroup". This will occur when the
group's line in $LIB/moderators contains only spaces (no tabs) between
the newsgroup name and the moderator's address. The problem is that
<ctype.h> rules that a space is a punctuation character. In the
routine twosplit(), in postnews.c (old code commented in for loop):

* Split a line of the form
* text whitespace text
* into two strings. Also trim off any trailing newline.
* This is destructive on src.
twosplit(src, dest1, dest2)
char *src, *dest1, *dest2;
[three lines deleted]
for (p=src; !isspace(*p)/*isalnum(*p) || ispunct(*p)*/; p++)
[five more lines deleted]

This even makes the comment accurate!
der Mouse

USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!mcgill-vision!mouse
ARPAnet: utcsri!mcgill-vision!

"Come with me a few minutes, mortal, and we shall talk."
- Thanatos (Piers Anthony's Bearing an Hourglass)

Arthur David Olson

Aug 22, 1986, 11:37:04 AM8/22/86
> for (p=src; !isspace(*p)/*isalnum(*p) || ispunct(*p)*/; p++)
> ;

Since isspace('\0') is false (at least on our 4.1BSD system), our department
of defensive programming recommends that the above test take the form

> for (p=src; *p != '\0' && !isspace(*p); p++)
> ;
Bug/s is a Volkswagen/Warner Brothers trademark.
UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!a...@seismo.ARPA
DEC, VAX, Elsie & Ado are Digital, Borden & Ampex trademarks.

Reply all
Reply to author
0 new messages