[asterisk-bugs] [Asterisk 0019185]: [patch] Asterisk crashes with a segfault if current host cannot be resolved via DNS.

Asterisk Bug Tracker noreply at bugs.digium.com
Wed May 4 15:50:20 CDT 2011


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=19185 
====================================================================== 
Reported By:                dswartz
Assigned To:                may213
====================================================================== 
Project:                    Asterisk
Issue ID:                   19185
Category:                   Addons/chan_ooh323
Reproducibility:            always
Severity:                   crash
Priority:                   normal
Status:                     feedback
Asterisk Version:           1.8.3.3 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2011-04-26 13:46 CDT
Last Modified:              2011-05-04 15:50 CDT
====================================================================== 
Summary:                    [patch] Asterisk crashes with a segfault if current
host cannot be resolved via DNS.
Description: 
int ooGetLocalIPAddress(char * pIPAddrs)
{
   int ret;
   struct hostent *hp;
   struct ast_hostent phost;
   char hostname[100];

   if(pIPAddrs == NULL)
      return -1; /* Need to find suitable return value */
   ret = gethostname(hostname, 100);
   if(ret == 0)
   {
      if (!(hp = ast_gethostbyname(hostname, &phost))) {
                        struct in_addr i;
                        memcpy(&i, hp->h_addr, sizeof(i));

If gethostname() fails, and then ast_gethostbyname() does as well, we will
go to the memcpy, dereferencing the null 'hp'.

======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0018278 [patch] ipv6 support in chan_ooh323
====================================================================== 

---------------------------------------------------------------------- 
 (0134454) svnbot (reporter) - 2011-05-04 15:50
 https://issues.asterisk.org/view.php?id=19185#c134454 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 316874

U   branches/1.8/addons/ooh323c/src/ooSocket.c

------------------------------------------------------------------------
r316874 | may | 2011-05-04 15:50:19 -0500 (Wed, 04 May 2011) | 11 lines

Fix trivial bug in ooSocket.c codes

Revert condition for result code of
ast_gethostbyname

(closes issue https://issues.asterisk.org/view.php?id=19185)
Reported by: dswartz
Patches: 
      issue19185-patch uploaded by may213 (license 454)


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=316874 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-05-04 15:50 svnbot         Checkin                                      
2011-05-04 15:50 svnbot         Note Added: 0134454                          
======================================================================




More information about the asterisk-bugs mailing list