Exclude IPv6 stuff in SearchByTarget when UPNP_ENABLE_IPV6 is not defined.
This commit is contained in:
parent
04e5767ea0
commit
41412c16ef
@ -2,6 +2,10 @@
|
|||||||
Version 1.6.16
|
Version 1.6.16
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
|
2012-03-10 Yoichi NAKAYAMA <yoichi.nakayama(at)gmail.com>
|
||||||
|
|
||||||
|
Exclude IPv6 stuff in SearchByTarget when UPNP_ENABLE_IPV6 is not defined.
|
||||||
|
|
||||||
2012-03-10 Yoichi NAKAYAMA <yoichi.nakayama(at)gmail.com>
|
2012-03-10 Yoichi NAKAYAMA <yoichi.nakayama(at)gmail.com>
|
||||||
|
|
||||||
Further measures against buffer overflows.
|
Further measures against buffer overflows.
|
||||||
|
@ -493,12 +493,18 @@ int SearchByTarget(int Mx, char *St, void *Cookie)
|
|||||||
int *id = NULL;
|
int *id = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char ReqBufv4[BUFSIZE];
|
char ReqBufv4[BUFSIZE];
|
||||||
|
#ifdef UPNP_ENABLE_IPV6
|
||||||
char ReqBufv6[BUFSIZE];
|
char ReqBufv6[BUFSIZE];
|
||||||
char ReqBufv6UlaGua[BUFSIZE];
|
char ReqBufv6UlaGua[BUFSIZE];
|
||||||
|
#endif
|
||||||
struct sockaddr_storage __ss_v4;
|
struct sockaddr_storage __ss_v4;
|
||||||
|
#ifdef UPNP_ENABLE_IPV6
|
||||||
struct sockaddr_storage __ss_v6;
|
struct sockaddr_storage __ss_v6;
|
||||||
|
#endif
|
||||||
struct sockaddr_in *destAddr4 = (struct sockaddr_in *)&__ss_v4;
|
struct sockaddr_in *destAddr4 = (struct sockaddr_in *)&__ss_v4;
|
||||||
|
#ifdef UPNP_ENABLE_IPV6
|
||||||
struct sockaddr_in6 *destAddr6 = (struct sockaddr_in6 *)&__ss_v6;
|
struct sockaddr_in6 *destAddr6 = (struct sockaddr_in6 *)&__ss_v6;
|
||||||
|
#endif
|
||||||
fd_set wrSet;
|
fd_set wrSet;
|
||||||
SsdpSearchArg *newArg = NULL;
|
SsdpSearchArg *newArg = NULL;
|
||||||
int timeTillRead = 0;
|
int timeTillRead = 0;
|
||||||
@ -527,23 +533,27 @@ int SearchByTarget(int Mx, char *St, void *Cookie)
|
|||||||
retVal = CreateClientRequestPacket(ReqBufv4, sizeof(ReqBufv4), timeTillRead, St, AF_INET);
|
retVal = CreateClientRequestPacket(ReqBufv4, sizeof(ReqBufv4), timeTillRead, St, AF_INET);
|
||||||
if (retVal != UPNP_E_SUCCESS)
|
if (retVal != UPNP_E_SUCCESS)
|
||||||
return retVal;
|
return retVal;
|
||||||
|
#ifdef UPNP_ENABLE_IPV6
|
||||||
retVal = CreateClientRequestPacket(ReqBufv6, sizeof(ReqBufv6), timeTillRead, St, AF_INET6);
|
retVal = CreateClientRequestPacket(ReqBufv6, sizeof(ReqBufv6), timeTillRead, St, AF_INET6);
|
||||||
if (retVal != UPNP_E_SUCCESS)
|
if (retVal != UPNP_E_SUCCESS)
|
||||||
return retVal;
|
return retVal;
|
||||||
retVal = CreateClientRequestPacketUlaGua(ReqBufv6UlaGua, sizeof(ReqBufv6UlaGua), timeTillRead, St, AF_INET6);
|
retVal = CreateClientRequestPacketUlaGua(ReqBufv6UlaGua, sizeof(ReqBufv6UlaGua), timeTillRead, St, AF_INET6);
|
||||||
if (retVal != UPNP_E_SUCCESS)
|
if (retVal != UPNP_E_SUCCESS)
|
||||||
return retVal;
|
return retVal;
|
||||||
|
#endif
|
||||||
|
|
||||||
memset(&__ss_v4, 0, sizeof(__ss_v4));
|
memset(&__ss_v4, 0, sizeof(__ss_v4));
|
||||||
destAddr4->sin_family = AF_INET;
|
destAddr4->sin_family = AF_INET;
|
||||||
inet_pton(AF_INET, SSDP_IP, &destAddr4->sin_addr);
|
inet_pton(AF_INET, SSDP_IP, &destAddr4->sin_addr);
|
||||||
destAddr4->sin_port = htons(SSDP_PORT);
|
destAddr4->sin_port = htons(SSDP_PORT);
|
||||||
|
|
||||||
|
#ifdef UPNP_ENABLE_IPV6
|
||||||
memset(&__ss_v6, 0, sizeof(__ss_v6));
|
memset(&__ss_v6, 0, sizeof(__ss_v6));
|
||||||
destAddr6->sin6_family = AF_INET6;
|
destAddr6->sin6_family = AF_INET6;
|
||||||
inet_pton(AF_INET6, SSDP_IPV6_SITELOCAL, &destAddr6->sin6_addr);
|
inet_pton(AF_INET6, SSDP_IPV6_SITELOCAL, &destAddr6->sin6_addr);
|
||||||
destAddr6->sin6_port = htons(SSDP_PORT);
|
destAddr6->sin6_port = htons(SSDP_PORT);
|
||||||
destAddr6->sin6_scope_id = gIF_INDEX;
|
destAddr6->sin6_scope_id = gIF_INDEX;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* add search criteria to list */
|
/* add search criteria to list */
|
||||||
HandleLock();
|
HandleLock();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user