Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

2 views
Skip to first unread message

g...@sun.uucp

unread,
Oct 5, 1986, 4:36:16 PM10/5/86
to
For example, when you have a message such as:

From ho...@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: <ho...@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: ho...@bu-cs.bu.edu
Message-Id: <861001005...@bucse.bu.edu>
To: ab, alpert, karenl, veress
Subject: changes

Text text text text text...

and try a "reply", it sends N copies to "ver...@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
g...@sun.com (or g...@sun.arpa)

Daniel R. Levy

unread,
Oct 7, 1986, 1:32:26 PM10/7/86
to
In article <79...@sun.uucp>, g...@sun.UUCP writes:
>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);
^(void)

> strcpy(rbuf, name);
^(void)

>--- 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);

^(void)

> if (debug) fprintf(stderr, "%s\n", rbuf);

^(void)


>! 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

Hey, while you're making fixes to the "functionality" (love that non-word...)
why not make lint fixes too?
--
------------------------------- Disclaimer: The views contained herein are
| dan levy | yvel nad | my own and are not at all those of my em-
| an engihacker @ | ployer or the administrator of any computer
| at&t computer systems division | upon which I may hack.
| skokie, illinois |
-------------------------------- Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
go for it! allegra,ulysses,vax135}!ttrdc!levy

Guy Harris

unread,
Oct 9, 1986, 3:31:17 AM10/9/86
to
> Hey, while you're making fixes to the "functionality" (love that
> non-word...)

From "The Merriam-Webster Webster's Third New International Dictionary":

func*tion*al*i*ty n -ES : the quality, state, or relation
of being functional : UTILITY : INTERRELATION

So it's a word, although not meaning what computeroids use it to mean....

> why not make lint fixes too?

I did - about 10 tons of them - and posted them a long while ago. After a
while, though, you reach the point of diminishing returns, and frankly I'd
gotten tired of throwing "(void)"s into somebody else's code. I didn't see
much point in throwing them in in new code when they weren't there in the
existing code.

If you want to run all of "mailx" or "Mail" through "lint", be my guest....

0 new messages