Explorar el Código

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.
Andrew Mortensen hace 12 años
padre
commit
3bae735a5e
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      modules/sca/sca_subscribe.c

+ 2 - 2
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 */
     /* XXX this should be locked; could use a filled-in req_sub */
     if ( sca_notify_subscriber( sca, &req_sub, app_idx ) < 0 ) {
     if ( sca_notify_subscriber( sca, &req_sub, app_idx ) < 0 ) {
 	LM_ERR( "SCA %s SUBSCRIBE+NOTIFY for %.*s failed",
 	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?
 	 * XXX - what does subscriber do in this case? drop subscription?
 	 * sub is already saved/updated in hash table. let it rot?
 	 * sub is already saved/updated in hash table. let it rot?