On Mon, Jul 15, 2002 at 05:58:23PM -0700, Kevin Steves wrote:
> @@ -351,9 +351,6 @@
>  void
>  safeputchar(int c)
>  {
> -     unsigned char ch;
> -
> -     ch = (unsigned char)(c & 0xff);
>       if (c < 0x80 && isprint(c))
>               printf("%c", c & 0xff);
>       else

Actually, it *should* be used:

        if (ch < 0x80 && isprint(ch)
                printf("%c", ch)
        else
                printf("\\%03o", ch);   

as if "safeputchar" is handed the result of dereferencing a "char *",
and that byte has the 8th bit set, it'll be sign-extended, on machines
with signed "char", and passed to "safeputchar()" as a negative number;
that value will be < 0x80, as it's negative, but it's not safe to hand
it to "isprint()".

I've checked that in.

(BTW, are you the Kevin Steves formerly at "[EMAIL PROTECTED]"?)
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe

Reply via email to