[Asterisk-Dev] Re: [Asterisk-cvs] asterisk enum.c,1.22,1.23
Kevin P. Fleming
kpfleming at starnetworks.us
Sat Mar 12 00:12:15 MST 2005
markster at lists.digium.com wrote:
> + answer[len] = (u_char)"\0";
> + c->txt[(c->txtlen)-1] = (char)"\0";
These are very broken... casting a pointer to a string containing a
single null byte into a char (or u_char) does not result in a char with
a zero value... it results in a char containing the lowest 8 bits of the
address in the pointer.
I presume these casts were added because the compiler complained about
assigning "\0" to a char variable, as it rightly should, because they
are not compatible types. Forcing the error to go away by casting was
not the correct fix, though.
More information about the asterisk-dev
mailing list