]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip_session: Do not call session supplements when it's too late. 55/4355/1
authorMark Michelson <mmichelson@digium.com>
Tue, 8 Nov 2016 16:48:32 +0000 (10:48 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Wed, 9 Nov 2016 16:50:34 +0000 (09:50 -0700)
commit87e1ebc91a46d1b0e6c2d8fc793f8bdd10f06b54
tree3e5bc1a4f4e95bc3b2bb2a28d66ebdd6ae831998
parentc8df7275027ba1bad7dabd1cbcbc3aa1c4ec976d
res_pjsip_session: Do not call session supplements when it's too late.

res_pjsip_sesssion was hooking into transaction and invite state
changes. One of the reasons for doing so was due to the
PJSIP_EVENT_TX_MSG event. The idea was that we were hooking into the
message sending process, and so we should call session supplements to
alter the outgoing message.

In reality, this event was meant to indicate that the message either
a) had already been sent, or
b) required a DNS lookup and would be sent when the DNS query
completed.

In case (a), this meant we were altering an already-sent
request/response for no reason. In case (b), this potentially meant we
could be trying to alter a request/response at the same time that the
DNS resolution completed. In this case, it meant we might be stomping on
memory being used by the thread actually sending the message. This
caused potential crashes and memory corruption.

This patch removes the calls to session supplements from the case where
the PJSIP_EVENT_TX_MSG event occurs. In all of these cases, trying to
alter the message at this point is too late, and it can cause nothing
but harm to try to do it. Because there were no longer any calls to the
handle_outgoing() function, it has been removed.

Change-Id: Ibcc223fb1c3a237927f38754e0429e80ee301e92
(cherry picked from commit e043d1a55cf356066b3b39ebac8b4bbb612ce807)
res/res_pjsip_session.c