This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: glibc 2.3.1: fix for the i386 inline strings code
On Tue, Jan 07, 2003 at 07:40:08PM +0100, Michael Riepe wrote:
> 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.
You are right, indeed... There must be the (unsigned char*) cast.