[sr-dev] git:master: modules/dialog_ng: prevent seg fault if socket struct is null

Jason Penton jason.penton at gmail.com
Tue Oct 28 16:27:27 CET 2014


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

Author: Jason Penton <jason.penton at gmail.com>
Committer: Jason Penton <jason.penton at gmail.com>
Date:   Tue Oct 28 17:26:43 2014 +0200

modules/dialog_ng: prevent seg fault if socket struct is null

---

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

diff --git a/modules/dialog_ng/dlg_db_handler.c b/modules/dialog_ng/dlg_db_handler.c
index d966f8a..99fa7cd 100644
--- a/modules/dialog_ng/dlg_db_handler.c
+++ b/modules/dialog_ng/dlg_db_handler.c
@@ -885,7 +885,7 @@ error:
 int update_dialog_out_dbinfo_unsafe(struct dlg_cell * cell)
 {
 	struct dlg_cell_out *dlg_out	= cell->dlg_entry_out.first;
-
+	str x = {0,0};
 	if(use_dialog_out_table()!=0)
 		return -1;
 
@@ -935,7 +935,7 @@ int update_dialog_out_dbinfo_unsafe(struct dlg_cell * cell)
 		    SET_STR_VALUE(GET_FIELD_IDX(values, DLGO_CALLEE_CSEQ_IDX), dlg_out->callee_cseq);
 		    SET_STR_VALUE(GET_FIELD_IDX(values, DLGO_CALLEE_CONTACT_IDX), dlg_out->callee_contact);
 		    SET_STR_VALUE(GET_FIELD_IDX(values, DLGO_CALLEE_ROUTESET_IDX), dlg_out->callee_route_set);
-		    SET_STR_VALUE(GET_FIELD_IDX(values, DLGO_CALLEE_SOCK_IDX), dlg_out->callee_bind_addr->sock_str);
+		    SET_STR_VALUE(GET_FIELD_IDX(values, DLGO_CALLEE_SOCK_IDX), dlg_out->callee_bind_addr?dlg_out->callee_bind_addr->sock_str:x);
 
 		    SET_PROPER_NULL_FLAG(dlg_out->callee_route_set, values, DLGO_CALLEE_ROUTESET_IDX);
 		    SET_PROPER_NULL_FLAG(dlg_out->caller_cseq, values, DLGO_CALLER_CSEQ_IDX);




More information about the sr-dev mailing list