Fix to 2.10.2 postnews Subject: line bug

John M Sellens jmsellens at watmath.UUCP
Fri Jan 18 22:42:36 AEST 1985


When postnews rotates an offensive joke it mangles the header.  The
reason is that the same buffer is used for two different strings.
The following simple fix to postnews will make your joke Subject:
lines look like
> Subject: Original subject - offensive to something (ROT13)
instead of
> Subject: Original subjectSubject: Original subject

*** old.postnews.c	Fri Jan 18 07:35:06 1985
--- postnews.c	Fri Jan 18 07:34:38 1985
***************
*** 341,346
  
  	if (ngmatch(newsgroups, "all.jokes")) {
  		if (askyes("Could this be offensive to anyone? ","")) {
  			getpr("Whom might it offend? ", group);
  			sprintf(buf," - offensive to %s (ROT13)",group);
  			modify_article(tempfname, "Subject: ", buf, "append");

--- 341,347 -----
  
  	if (ngmatch(newsgroups, "all.jokes")) {
  		if (askyes("Could this be offensive to anyone? ","")) {
+ 			char jbuf[BUFLEN];
  			getpr("Whom might it offend? ", group);
  			sprintf(jbuf," - offensive to %s (ROT13)",group);
  			modify_article(tempfname, "Subject: ", jbuf, "append");
***************
*** 342,349
  	if (ngmatch(newsgroups, "all.jokes")) {
  		if (askyes("Could this be offensive to anyone? ","")) {
  			getpr("Whom might it offend? ", group);
! 			sprintf(buf," - offensive to %s (ROT13)",group);
! 			modify_article(tempfname, "Subject: ", buf, "append");
  			encode(tempfname);
  		}
  	}

--- 343,350 -----
  		if (askyes("Could this be offensive to anyone? ","")) {
  			char jbuf[BUFLEN];
  			getpr("Whom might it offend? ", group);
! 			sprintf(jbuf," - offensive to %s (ROT13)",group);
! 			modify_article(tempfname, "Subject: ", jbuf, "append");
  			encode(tempfname);
  		}
  	}


----
John M Sellens
UUCP:  {decvax|utzoo|ihnp4|allegra|clyde}!watmath!jmsellens
CSNET: jmsellens%watmath at waterloo.csnet
ARPA:  jmsellens%watmath%waterloo.csnet at csnet-relay.arpa



More information about the Comp.sources.bugs mailing list