diff options
author | jpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-07 21:34:45 +0000 |
---|---|---|
committer | jpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-07 21:34:45 +0000 |
commit | 854db8a3ba6b65929bb6482a9a52b494f41a2cc4 (patch) | |
tree | 3818299b085f3d105f8195e7d69d21699b24995b /channels | |
parent | faddb949839100acea93934d82a69a2a1b403e04 (diff) |
(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.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@113240 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index fe89d9730..b0e2108ae 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2539,9 +2539,9 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i * 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)))) { |