[sr-dev] git:master:dbd52dac: core: avoid accessing freed structure in case of duplicated listen addresses

Daniel-Constantin Mierla miconda at gmail.com
Mon Jul 3 15:01:41 CEST 2017


Module: kamailio
Branch: master
Commit: dbd52dacae17eca5a48359c605a2d93607b7c041
URL: https://github.com/kamailio/kamailio/commit/dbd52dacae17eca5a48359c605a2d93607b7c041

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-03T14:42:03+02:00

core: avoid accessing freed structure in case of duplicated listen addresses

---

Modified: src/core/socket_info.c

---

Diff:  https://github.com/kamailio/kamailio/commit/dbd52dacae17eca5a48359c605a2d93607b7c041.diff
Patch: https://github.com/kamailio/kamailio/commit/dbd52dacae17eca5a48359c605a2d93607b7c041.patch

---

diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index 62a15f4c93..8344c950f2 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -1597,7 +1597,7 @@ static int fix_socket_list(struct socket_info **list, int* type_flags)
 				ail=ail_next;
 				continue;
 			}
-			/* 2. check if the extra addresses contain a duplicates for 
+			/* 2. check if the extra addresses contain a duplicates for
 			 *  other addresses in the same list */
 			for (tmp_ail=ail->next; tmp_ail;){
 				tmp_ail_next=tmp_ail->next;
@@ -1614,6 +1614,9 @@ static int fix_socket_list(struct socket_info **list, int* type_flags)
 									si->port_no, si->proto);
 						/* remove tmp_ail*/
 					addr_info_listrm(&si->addr_info_lst, tmp_ail);
+					if(ail_next==tmp_ail) {
+						ail_next = tmp_ail_next;
+					}
 					free_addr_info(tmp_ail);
 				}
 				tmp_ail=tmp_ail_next;




More information about the sr-dev mailing list