Re: glibc 2.3.1: fix for the i386 inline strings code

Michael Riepe <[email protected]> Tue, 7 Jan 2003 19:40:08 +0100
Newsgroups org.kernel.vger.linux-gcc
Message-ID <[email protected]>
On Tue, Jan 07, 2003 at 08:43:01AM +0500, Denis Zaitsev wrote:
[...]
> The exact problem with XtNewString is that we have the "void pointer
> dereference" error when it is used with void* argument: XtNewString is
> a macros which uses strcpy, whose inline variant, in turn, uses
> __STRING_SMALL_GET(16|32), which don't cast their (str) argument to
> (char*).  The patch inserts such a casting.  But this is not the
> X-specific problem, I just met it when was compiling X.  It's a
> general error - string functions should work happily with void*
> arguments, so __STRING_SMALL_GET macros' must not assume their (str)
> argument can't be of type void*...

To be more specific: __STRING_SMALL_GET expects the (str) argument to
be an `unsigned char *'. Everything else will make it do funny things
when (signed) characters have values >= 128. Since __strcpy_a_small()
and __stpcpy_a_small() pass the pointer unmodified, they're broken as
well.

-- 
 Michael "Tired" Riepe <[email protected]>
 "All I wanna do is have a little fun before I die"