[asterisk-commits] rizzo: branch rizzo/astobj2 r47916 -
/team/rizzo/astobj2/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Nov 22 02:51:17 MST 2006
Author: rizzo
Date: Wed Nov 22 03:51:17 2006
New Revision: 47916
URL: http://svn.digium.com/view/asterisk?view=rev&rev=47916
Log:
add a bit of debugging to handle_response_register(),
also prevent some potential NULL pointer dereference.
Modified:
team/rizzo/astobj2/channels/chan_sip.c
Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47916&r1=47915&r2=47916
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Wed Nov 22 03:51:17 2006
@@ -12310,11 +12310,24 @@
}
}
-/*! \brief Handle responses on REGISTER to services */
+/*! \brief Handle responses on REGISTER to services.
+ * In principle, we should have p->registry != NULL,
+ * and p->registry->register_pvt == p, otherwise there is
+ * something bogus
+ */
static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno)
{
int expires, expires_ms;
struct sip_registry *r = p->registry;
+
+ if (r == NULL || r->register_pvt != p) {
+ if (r == NULL)
+ ast_log(LOG_WARNING, "Got %d on REGISTER but we have no sip_registry entry", resp);
+ else
+ ast_log(LOG_WARNING, "Got %d on REGISTER, but mismatched link p %p reg->p %p", resp, p, r->register_pvt);
+ set_destroy(p);
+ return 1;
+ }
switch (resp) {
case 401: /* Unauthorized */
More information about the asterisk-commits
mailing list