Browse code

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

(cherry picked from commit dbd52dacae17eca5a48359c605a2d93607b7c041)
(cherry picked from commit e070571cf59a43b615690a3ec2fd9194d20e1e1d)

Daniel-Constantin Mierla authored on 03/07/2017 12:42:03
Showing 1 changed files
... ...
@@ -1589,7 +1589,7 @@ static int fix_socket_list(struct socket_info **list, int* type_flags)
1589 1589
 				ail=ail_next;
1590 1590
 				continue;
1591 1591
 			}
1592
-			/* 2. check if the extra addresses contain a duplicates for 
1592
+			/* 2. check if the extra addresses contain a duplicates for
1593 1593
 			 *  other addresses in the same list */
1594 1594
 			for (tmp_ail=ail->next; tmp_ail;){
1595 1595
 				tmp_ail_next=tmp_ail->next;
... ...
@@ -1606,6 +1606,9 @@ static int fix_socket_list(struct socket_info **list, int* type_flags)
1606 1606
 									si->port_no, si->proto);
1607 1607
 						/* remove tmp_ail*/
1608 1608
 					addr_info_listrm(&si->addr_info_lst, tmp_ail);
1609
+					if(ail_next==tmp_ail) {
1610
+						ail_next = tmp_ail_next;
1611
+					}
1609 1612
 					free_addr_info(tmp_ail);
1610 1613
 				}
1611 1614
 				tmp_ail=tmp_ail_next;