Stuart Henderson <[EMAIL PROTECTED]> writes:

> Does anyone have time to help with an alignment problem in
> asterisk that was reported to me? I've been trying to learn
> enough C to work it out myself but haven't had luck/time yet
> and with 3.9 approaching thought it would be better to ask.
> 
> The offending code seems to be line 699 of channels/iax2-parse.c,
> parsing incoming iax packets from the network -
> 
> int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
> {
> ...
> case IAX_IE_APPARENT_ADDR:
> ies->apparent_addr = ((struct sockaddr_in *)(data + 2));
> ...
> 
Ugly code, but a simple fix might be:

int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen) {
        struct sockaddr_in moo;
        ...
        case IAX_IE_APPARENT_ADDR:
                bcopy(data + 2, &moo, sizeof(moo));
                ies->apparent_addr = &moo;
        ...
Without looking at the actual code, it's hard to say whether this would
actually work (ie. moo is an auto variable, and disappears when the
functions exits, etc).

--Jason L. Wright

Reply via email to