[asterisk-commits] jpeeler: branch 1.4 r113240 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 7 16:34:47 CDT 2008


Author: jpeeler
Date: Mon Apr  7 16:34:45 2008
New Revision: 113240

URL: http://svn.digium.com/view/asterisk?view=rev&rev=113240
Log:
(closes issue #12362) [redo of 113012]

This fixes a for loop (in realtime_peer) to check all the ast_variables the loop was intending to test rather than just the first one. The change exposed the problem of calling memcpy on a NULL pointer, in this case the passed in sockaddr_in struct which is now checked. 


Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=113240&r1=113239&r2=113240
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Mon Apr  7 16:34:45 2008
@@ -2539,9 +2539,9 @@
 			 * is because we only have the IP address and the host field might be
 			 * set as a name (and the reverse PTR might not match).
 			 */
-			if (var) {
+			if (var && sin) {
 				for (tmp = var; tmp; tmp = tmp->next) {
-					if (!strcasecmp(var->name, "host")) {
+					if (!strcasecmp(tmp->name, "host")) {
 						struct hostent *hp;
 						struct ast_hostent ahp;
 						if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {




More information about the asterisk-commits mailing list