[sr-dev] git:master: sca: prevent possible NULL-dereference in log message when NOTIFY fails.

Andrew Mortensen admorten at isc.upenn.edu
Thu Feb 21 23:04:38 CET 2013


Module: sip-router
Branch: master
Commit: 3bae735a5e38414bd53738928ba531a329290777
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3bae735a5e38414bd53738928ba531a329290777

Author: Andrew Mortensen <admorten at isc.upenn.edu>
Committer: Andrew Mortensen <admorten at isc.upenn.edu>
Date:   Thu Feb 21 17:00:31 2013 -0500

sca: prevent possible NULL-dereference in log message when NOTIFY fails.

- sub struct may be NULL outside of else block. Use non-shmem req_sub from
  incoming SUBSCRIBE packet instead.

---

 modules/sca/sca_subscribe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/sca/sca_subscribe.c b/modules/sca/sca_subscribe.c
index 2f7a7f0..3307820 100644
--- a/modules/sca/sca_subscribe.c
+++ b/modules/sca/sca_subscribe.c
@@ -1248,8 +1248,8 @@ sca_handle_subscribe( sip_msg_t *msg, char *p1, char *p2 )
     /* XXX this should be locked; could use a filled-in req_sub */
     if ( sca_notify_subscriber( sca, &req_sub, app_idx ) < 0 ) {
 	LM_ERR( "SCA %s SUBSCRIBE+NOTIFY for %.*s failed",
-		sca_event_name_from_type( sub->event ),
-		STR_FMT( &sub->subscriber ));
+		sca_event_name_from_type( req_sub.event ),
+		STR_FMT( &req_sub.subscriber ));
 	/*
 	 * XXX - what does subscriber do in this case? drop subscription?
 	 * sub is already saved/updated in hash table. let it rot?




More information about the sr-dev mailing list