Commit 95a8a7f8 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

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

(cherry picked from commit bec798ac1c338b4694889d9c5205c606ae100c0a)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent ce4f0079
--- 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) {
--- 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) {
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment