[Home]

Summary:ASTERISK-05341: recent changes to utils.c seg. faults asterisk
Reporter:paradise (paradise)Labels:
Date Opened:2005-10-21 02:07:12Date Closed:2005-10-21 13:34:19
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:seems this will happen when setting bindaddress=0.0.0.0 in sip.conf

#0  0x080c9f4d in ast_gethostbyname (host=0x812f059 "0.0.0.0", hp=0xbfffef90) at utils.c:194
       res = -1208424796
       herrno = 303104
       dots = 4218694
       s = 0xbfffefa4 ""
       result = (struct hostent *) 0x0
Comments:By: paradise (paradise) 2005-10-21 02:10:55

the CVS date with this bug is 10-21-2005

By: Olle Johansson (oej) 2005-10-21 02:19:19

That was the fix for octal IP addresses...

By: Olle Johansson (oej) 2005-10-21 02:19:36

Which platform are you using?

By: paradise (paradise) 2005-10-21 02:34:21

FC3 on Pentium 4 with HT enabled
kernel 2.6.11-1.27_FC3smp

By: adomjan (adomjan) 2005-10-21 08:08:08

I have the same problem, after the upgrade.
FC3

By: Clod Patry (junky) 2005-10-21 08:15:39

Could you provide a backtrace, like said in the bug guidelines?

By: jaredmauch (jaredmauch) 2005-10-21 09:55:30

i'm also having the same issue.  i backed this out on my system and asterisk no longer crashes.

By: jaredmauch (jaredmauch) 2005-10-21 09:57:09

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1209386064 (LWP 6426)]
0x080c2887 in ast_gethostbyname (host=0xb7e9f03c "216.189.180.169", hp=0xb7e9ec1c) at utils.c:194
194                     hp->hp.h_addr = hp->buf;
(gdb) bt
#0  0x080c2887 in ast_gethostbyname (host=0xb7e9f03c "216.189.180.169", hp=0xb7e9ec1c) at utils.c:194
#1  0x002562c7 in check_via (p=0x8f18590, req=0xb7ea0b90) at chan_sip.c:6794
#2  0x002720bb in handle_request_register (p=0x8f18590, req=0xb7ea0b90, debug=Variable "debug" is not available.
) at chan_sip.c:10772
#3  0x00281b93 in handle_request (p=0x8f18590, req=0xb7ea0b90, sin=0xb7ea1ec0, recount=0xa, nounlock=0xa)
   at chan_sip.c:10929
#4  0x00282857 in sipsock_read (id=0x8f11930, fd=9, events=1, ignore=0x0) at chan_sip.c:11046
ASTERISK-1  0x0805587d in ast_io_wait (ioc=0x8dc03c8, howlong=10) at io.c:284
ASTERISK-2  0x0027a8af in do_monitor (data=0x0) at chan_sip.c:11191
ASTERISK-3  0x0086ab80 in start_thread () from /lib/libpthread.so.0
ASTERISK-4  0x00db69ce in clone () from /lib/libc.so.6

By: gkloepfer (gkloepfer) 2005-10-21 10:13:37

The problem is in the following code:

               /* Forge a reply for IP's to avoid octal IP's being interpreted as octal */
               if (dots != 3)
                       return NULL;
               hp->hp.h_addr = hp->buf;
               if (inet_pton(AF_INET, host, hp->hp.h_addr) > 0)
                       return &hp->hp;
               return NULL;

       }

The assumption that hp.h_addr is an already-allocated array is wrong.  It
is actually a char **.  I discovered this in the backtrace that I forgot
to save (sorry guys).

I was looking at this a while and still am not sure why this is needed in
the first place.  When is the "octal IP" problem going to occur?

By: Olle Johansson (oej) 2005-10-21 10:36:51

#0  0x080b4bd3 in ast_gethostbyname (host=0x81359e9 "213.204.186.39", hp=0xbfbff0a0) at utils.c:194
194                     memset(hp, 0, sizeof(struct ast_hostent));

Still a crash... Sorry.

By: Olle Johansson (oej) 2005-10-21 10:46:03

Now I am getting this...

#0  ast_gethostbyname (host=0x837c369 "213.204.186.39", hp=0x837c369) at utils.c:196

196                     hp->hp.h_addr = hp->buf + sizeof(void *);

By: Olle Johansson (oej) 2005-10-21 10:48:00

...hmmm, third re-compile it works... Maybe I am too worried... :-)

By: Olle Johansson (oej) 2005-10-21 10:50:03

Too anxious to wait for cvs mirrors I guess.