[comp.mail.misc] What does %u mean to smail 3?

news@puzzle.UUCP (newshound) (01/10/90)

	What significance does %u have to smail 3?  I sent a mail message
to someone at uokmax.ecn.uoknor.edu, using this form:
	username%uokmax.ecn.uoknor.edu@my_backbone
and it was resolved to
	username2155879098okmax.ecn.uoknor.edu@my_backbone
but the expansion is not in the smail logfile.  How can I escape the % so
that smail reads it literally?

-- Bob
 ------------------------------------------------------------------------------
                     Bob Izenberg [ ] Ralph Kirkley Associates
              attctc!puzzle!bei    512 346 7019 (home)    Austin, TX
 ------------------------------------------------------------------------------

skl@van-bc.UUCP (Samuel Lam) (01/10/90)

In article <110@puzzle.UUCP>, news@puzzle.UUCP (newshound) wrote:
>	What significance does %u have to smail 3?  I sent a mail message
>to someone at uokmax.ecn.uoknor.edu, using this form:
>	username%uokmax.ecn.uoknor.edu@my_backbone
>and it was resolved to
>	username2155879098okmax.ecn.uoknor.edu@my_backbone
>but the expansion is not in the smail logfile.  How can I escape the % so
>that smail reads it literally?

It sounds like the address string is being used as the format string of
a printf()/fprintf()/sprintf() call, as in:

	printf(address);		/* incorrect */

instead of

	printf("%s", address);		/* correct */

.  The only sure-fire way to fix this problem is to go into the source
and find that particular printf/fprintf/sprintf call and fix it.

...Sam
-- 
Internet: <skl@wimsey.bc.ca>	UUCP: {van-bc,ubc-cs,uunet}!wimsey.bc.ca!skl

randyo@microsoft.UUCP (Randy ORRISON) (01/11/90)

In article <110@puzzle.UUCP> news@puzzle.UUCP (newshound) writes:
| 	What significance does %u have to smail 3?  I sent a mail message
| to someone at uokmax.ecn.uoknor.edu, using this form:
| 	username%uokmax.ecn.uoknor.edu@my_backbone
| and it was resolved to
| 	username2155879098okmax.ecn.uoknor.edu@my_backbone

Without looking at the source, I would be willing to bet that somewhere
in smail3 is a line like this:

    printf(address);

The '%u' in the address is being interpreted by printf as a format
specification for an unsigned int, and it's grabbing garbage off the
stack to put in there.  The solution, of course, is to not use an
address as a format string.  Either printf("%s",address), or even
better, fputs(address,stdout) will do what is needed.

Disclaimer:  This is a great way to look like a fool if I'm wrong.

    -randy
-- 
Randy C. Orrison -- Just an employee of Microsoft Corp, not a spokesman
uunet!microsoft!randyo	   microsoft!cctb!randy	      randy@cctb.wa.com
		In 1869 the waffle iron was invented
		for people who had wrinkled waffles.

flinton@eagle.wesleyan.edu (01/12/90)

In article <110@puzzle.UUCP>, news@puzzle.UUCP (newshound) writes:
 
> What significance does %u have to smail 3?  
> 	username%uokmax.ecn.uoknor.edu@my_backbone
> was resolved to
> 	username2155879098okmax.ecn.uoknor.edu@my_backbone

That looks like a Pennsylvania phone number (215) 587 9098 (!) -- in your
dialers setup, perhaps?

> How can I escape the % so that smail reads it literally?

Hunches and guess-work: use %% ?  use /% or \% ?  quote the whole 
address-string?  or avoid the problem with !-path addressing syntax?

Anyway, be glad your O/S doesn't treat % as the token marking the start
of a mere _comment_ (as the local VAX used to do with the ! symbol).
								      -- Fred