[vlc-commits] upnp: Fix some libupnp bugs

Hugo Beauzée-Luyssen git at videolan.org
Mon May 11 18:38:30 CEST 2015


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon May 11 18:19:26 2015 +0200| [bec798ac1c338b4694889d9c5205c606ae100c0a] | committer: Hugo Beauzée-Luyssen

upnp: Fix some libupnp bugs

Those patches prevent an infinite loop when specifying an interface name, and
avoid using a down interface as the defautl interface.
fix #14526

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bec798ac1c338b4694889d9c5205c606ae100c0a
---

 contrib/src/upnp/dont_use_down_intf.patch |   12 ++++++++++++
 contrib/src/upnp/fix_infinite_loop.patch  |   21 +++++++++++++++++++++
 contrib/src/upnp/rules.mak                |    2 ++
 3 files changed, 35 insertions(+)

diff --git a/contrib/src/upnp/dont_use_down_intf.patch b/contrib/src/upnp/dont_use_down_intf.patch
new file mode 100644
index 0000000..6af6a47
--- /dev/null
+++ b/contrib/src/upnp/dont_use_down_intf.patch
@@ -0,0 +1,12 @@
+--- upnp_clean/upnp/src/api/upnpapi.c	2015-05-11 18:04:45.054340200 +0200
++++ libupnp-1.6.19/upnp/src/api/upnpapi.c	2015-05-11 18:11:37.438360600 +0200
+@@ -3258,7 +3258,8 @@
+		ifname_found = 1;
+	}
+	for (adapts_item = adapts; adapts_item != NULL; adapts_item = adapts_item->Next) {
+-		if (adapts_item->Flags & IP_ADAPTER_NO_MULTICAST) {
++		if (adapts_item->Flags & IP_ADAPTER_NO_MULTICAST ||
++			adapts_item->OperStatus != IfOperStatusUp) {
+			continue;
+        }
+		if (ifname_found == 0) {
diff --git a/contrib/src/upnp/fix_infinite_loop.patch b/contrib/src/upnp/fix_infinite_loop.patch
new file mode 100644
index 0000000..b9e2ab7
--- /dev/null
+++ b/contrib/src/upnp/fix_infinite_loop.patch
@@ -0,0 +1,21 @@
+--- upnp_clean/upnp/src/api/upnpapi.c	2015-05-11 17:59:17.892347500 +0200
++++ upnp/upnp/src/api/upnpapi.c	2015-05-11 18:01:05.000083700 +0200
+@@ -3257,8 +3257,7 @@
+ 		strncpy(gIF_NAME, IfName, sizeof(gIF_NAME) - 1);
+ 		ifname_found = 1;
+ 	}
+-	adapts_item = adapts;
+-	while (adapts_item != NULL) {
++	for (adapts_item = adapts; adapts_item != NULL; adapts_item = adapts_item->Next) {
+ 		if (adapts_item->Flags & IP_ADAPTER_NO_MULTICAST) {
+ 			continue;
+ 		}
+@@ -3345,8 +3344,6 @@
+ 			gIF_INDEX = adapts_item->IfIndex;
+ 			break;
+ 		}
+-		/* Next adapter. */
+-		adapts_item = adapts_item->Next;
+ 	}
+ 	/* Failed to find a valid interface, or valid address. */
+ 	if (ifname_found == 0 || valid_addr_found == 0) {
diff --git a/contrib/src/upnp/rules.mak b/contrib/src/upnp/rules.mak
index 14d05c0..dabeb6a 100644
--- a/contrib/src/upnp/rules.mak
+++ b/contrib/src/upnp/rules.mak
@@ -26,6 +26,8 @@ endif
 	$(APPLY) $(SRC)/upnp/libupnp-ipv6.patch
 	$(APPLY) $(SRC)/upnp/miniserver.patch
 	$(APPLY) $(SRC)/upnp/missing_win32.patch
+	$(APPLY) $(SRC)/upnp/fix_infinite_loop.patch
+	$(APPLY) $(SRC)/upnp/dont_use_down_intf.patch
 	$(UPDATE_AUTOCONFIG) && cd $(UNPACK_DIR) && mv config.guess config.sub build-aux/
 	$(MOVE)
 



More information about the vlc-commits mailing list