Summary: | ASTERISK-17756: [patch] Asterisk crashes with a segfault if current host cannot be resolved via DNS. | ||
Reporter: | Dan Swartzendruber (dswartz) | Labels: | |
Date Opened: | 2011-04-26 13:46:29 | Date Closed: | 2011-05-04 15:50:20 |
Priority: | Critical | Regression? | No |
Status: | Closed/Complete | Components: | Addons/chan_ooh323 |
Versions: | 1.8.3 | Frequency of Occurrence | |
Related Issues: | |||
Environment: | Attachments: | ( 0) issue19185-patch | |
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'. | ||
Comments: | By: Alexander Anikin (may213) 2011-04-28 01:07:10 Suggest that issue resolved in the trunk already. Could you check this with current trunk? By: Dan Swartzendruber (dswartz) 2011-04-28 07:53:22 I agree. It looks like it was fixed by the work done for bugfix 0018278. By: Alexander Anikin (may213) 2011-05-04 15:44:52 Due to this fixed within new feature codes that goes to the trunk only i produce separate bug fix here. By: Digium Subversion (svnbot) 2011-05-04 15:50:19 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 ASTERISK-17756) Reported by: dswartz Patches: issue19185-patch uploaded by may213 (license 454) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=316874 |