🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs.usg
Article #344

"mailx" screws up "reply" addresses in some cases

#344
From: guy
Date: Sun, 05 Oct 1986 20:36
70 lines
2474 bytes
For example, when you have a message such as:

	From homer@bu-cs.bu.edu Tue Sep 30 20:58:11 1986
	Received: by bu-cs.bu.edu (5.31/4.7)
		id AA21517; Tue, 30 Sep 86 20:58:06 EDT
	Return-Path: <homer@bu-cs.bu.edu>
	Received: by bucse.bu.edu (5.31/4.7)
		id AA16172; Tue, 30 Sep 86 20:57:55 EDT
	Date: Tue, 30 Sep 86 20:57:55 EDT
	From: homer@bu-cs.bu.edu
	Message-Id: <8610010057.AA16172@bucse.bu.edu>
	To: ab, alpert, karenl, veress
	Subject: changes

	Text text text text text...

and try a "reply", it sends N copies to "veress@bu-cs.bu.edu".

The problem is that a static buffer is being used for the address, and it
isn't saving that static buffer before using it for the next address; since
it sticks a pointer to that address in the structure representing a name,
all the names end up being the last name stuffed into that buffer.

The fix, to "optim.c", is:

------- optim.c -------
*** /tmp/da0248	Sun Oct  5 13:36:02 1986
--- optim.c	Sat Oct  4 02:04:18 1986
***************
*** 239,245 ****
  	char from[];
  {
  	register char *cp;
! 	static char rbuf[200];
  
  	if (debug) fprintf(stderr, "makeremote(%s, %s) returns ", name, from);
  	strcpy(rbuf, name);
--- 239,245 ----
  	char from[];
  {
  	register char *cp;
! 	char rbuf[BUFSIZ];
  
  	if (debug) fprintf(stderr, "makeremote(%s, %s) returns ", name, from);
  	strcpy(rbuf, name);
***************
*** 248,254 ****
  		cp = rindex(from, '%');
  	strcat(rbuf, cp);
  	if (debug) fprintf(stderr, "%s\n", rbuf);
! 	return rbuf;
  }
  
  /*
--- 248,254 ----
  		cp = rindex(from, '%');
  	strcat(rbuf, cp);
  	if (debug) fprintf(stderr, "%s\n", rbuf);
! 	return(savestr(rbuf));
  }
  
  /*

which allocates a new string buffer for each recipient and returns a point
to it instead of a pointer to the local buffer.  Since the local buffer is
now purely temporary, it is made automatic.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com (or guy@sun.arpa)
Technical Details
Message-ID: <7926@sun.uucp>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!husc6!panda!genrad!decvax!decwrl!sun!guy

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!husc6!panda!genrad!decvax!decwrl!sun!guy
From: guy@sun.UUCP
Newsgroups: net.bugs.usg
Subject: "mailx" screws up "reply" addresses in some cases
Message-ID: <7926@sun.uucp>
Date: Sun, 5-Oct-86 16:36:16 EDT
Article-I.D.: sun.7926
Posted: Sun Oct  5 16:36:16 1986
Date-Received: Tue, 7-Oct-86 20:50:34 EDT
Distribution: net
Organization: Sun Microsystems, Inc.
Lines: 70