On 2006/02/08 19:16, Ben Lovett wrote:
> On Feb 7, 2006, at 11:30 AM, Jason Wright wrote:
> >Ugly code, but a simple fix might be:
>
> I don't get a SIGBUS anymore, but it still fails to register with the  
> server properly.

Thanks for trying it Ben,

> >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).

Ok the parse function is just preparing things for use elsewhere,
so the auto variable is destroyed by the time it's needed. The place
where it's needed is actually paying some attention to alignment
since they memcpy, but I happened across a debian-devel post
mentioning a GCC optimizer bug requiring bcopy vs. memcpy, so
Ben, please can you try reverting iax2-parse change and apply
the attached diff.

--- channels/chan_iax2.c.orig   Thu Feb  9 15:17:15 2006
+++ channels/chan_iax2.c        Thu Feb  9 15:17:33 2006
@@ -5277,7 +5277,7 @@
        
        memset(&ied, 0, sizeof(ied));
        if (ies->apparent_addr)
-               memcpy(&new, ies->apparent_addr, sizeof(new));
+               bcopy(ies->apparent_addr, &new, sizeof(new));
        if (ies->callno)
                newcall = ies->callno;
        if (!newcall || !new.sin_addr.s_addr || !new.sin_port) {
@@ -5427,7 +5427,7 @@
 
        memset(&us, 0, sizeof(us));
        if (ies->apparent_addr)
-               memcpy(&us, ies->apparent_addr, sizeof(us));
+               bcopy(ies->apparent_addr, &us, sizeof(us));
        if (ies->username)
                ast_copy_string(peer, ies->username, sizeof(peer));
        if (ies->refresh)

Reply via email to