Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Mar 1996 09:32:11 +0100 (MET)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        freebsd-hackers@freebsd.org (FreeBSD hackers)
Cc:        serg@bcs1.bcs.zaporizhzhe.ua (Sergey Shkonda)
Subject:   Re: core dump in tr
Message-ID:  <199603170832.JAA10023@uriah.heep.sax.de>
In-Reply-To: <199603162027.AA01477@bcs1.bcs.zaporizhzhe.ua> from "Sergey Shkonda" at Mar 16, 96 10:27:44 pm

next in thread | previous in thread | raw e-mail | index | archive | help
As Sergey Shkonda wrote:
> 
> Try tr "A-B" "C-D"
> 
> ( A, B, C, D > 127 )

> ! 	u_char	*str;		/* user's string */

Thanks for pointing this out.  It didn't dump core for me, but
nevertheless, it didn't do what it was supposed to either.

I've modified your suggested fix.  The data type of any `char' that
holds a real string (as opposed to random byte-sized binary garbage)
should really be `char' (neither explicitly signed nor unsigned), but
before assigning it to an int or compare it with sign extension, it
should be casted to `u_char' first.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603170832.JAA10023>