From 53804c3db3cdf5a10d3d56c79e9481f9fe2d8556 Mon Sep 17 00:00:00 2001 From: Denis Leroy Date: Fri, 11 Dec 2015 16:59:38 +0100 Subject: [PATCH] Fix bug in returning IGD LAN address --- miniupnpc/miniupnpc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/miniupnpc/miniupnpc.c b/miniupnpc/miniupnpc.c index a39982c..bc93114 100644 --- a/miniupnpc/miniupnpc.c +++ b/miniupnpc/miniupnpc.c @@ -546,6 +546,7 @@ UPNP_GetValidIGD(struct UPNPDev * devlist, int state = -1; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */ int n_igd = 0; char extIpAddr[16]; + char myLanAddr[40]; if(!devlist) { #ifdef DEBUG @@ -568,7 +569,7 @@ UPNP_GetValidIGD(struct UPNPDev * devlist, /* we should choose an internet gateway device. * with st == urn:schemas-upnp-org:device:InternetGatewayDevice:1 */ desc[i].xml = miniwget_getaddr(dev->descURL, &(desc[i].size), - lanaddr, lanaddrlen, + myLanAddr, sizeof(myLanAddr), dev->scope_id); #ifdef DEBUG if(!desc[i].xml) @@ -586,6 +587,7 @@ UPNP_GetValidIGD(struct UPNPDev * devlist, { desc[i].is_igd = 1; n_igd++; + strncpy(lanaddr, myLanAddr, lanaddrlen); } } }