summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorStefan Schmidt <sst@sil.at>2011-12-13 15:22:48 +0000
committerStefan Schmidt <sst@sil.at>2011-12-13 15:22:48 +0000
commit7d1c55d093f44b0e468e04cab370e861de7c1878 (patch)
tree20b9115226e0d81da14ed14832da67a5f86a02f3 /channels/chan_sip.c
parent9057aa20b6b822d3c14c241bea9709e6b61d7dbe (diff)
Fix possible misshandling of an incoming SIP response as a peer poke response.
Also make sure peer has even qualify enabled when handle a peer poke response. (closes issue ASTERISK-18940) Reported by: Vitaliy Tested by: Vitaliy and UnixDev Review: https://reviewboard.asterisk.org/r/1620 Reviewed by: David Vossel ........ Merged revisions 348048 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 348056 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348061 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 8f3b411ae..c8e392795 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -21140,8 +21140,14 @@ static void handle_response_peerpoke(struct sip_pvt *p, int resp, struct sip_req
* -1 means did not respond, 0 means unknown,
* 1..maxms is a valid response, >maxms means late response.
*/
- if (pingtime < 1) /* zero = unknown, so round up to 1 */
+ if (pingtime < 1) { /* zero = unknown, so round up to 1 */
pingtime = 1;
+ }
+
+ if (!peer->maxms) { /* this should never happens */
+ pvt_set_needdestroy(p, "got OPTIONS response but qualify is not enabled");
+ return;
+ }
/* Now determine new state and whether it has changed.
* Use some helper variables to simplify the writing
@@ -21415,7 +21421,7 @@ static void handle_response(struct sip_pvt *p, int resp, const char *rest, struc
return;
}
- if (p->relatedpeer && p->method == SIP_OPTIONS) {
+ if (p->relatedpeer && sipmethod == SIP_OPTIONS) {
/* We don't really care what the response is, just that it replied back.
Well, as long as it's not a 100 response... since we might
need to hang around for something more "definitive" */