NanostackInterface: Check input address is IPv6

For the two calls that use the address - sendto and connect, check that it
actually is an IPv6 address.
pull/3165/head
Kevin Bracey 2016-10-31 10:15:36 +02:00
parent c9f9ffa583
commit 8e5391ab85
1 changed files with 8 additions and 0 deletions

View File

@ -716,6 +716,10 @@ int NanostackInterface::socket_sendto(void *handle, const SocketAddress &address
return NSAPI_ERROR_NO_SOCKET;
}
if (address.get_ip_version() != NSAPI_IPv6) {
return NSAPI_ERROR_UNSUPPORTED;
}
nanostack_lock();
int ret;
@ -849,6 +853,10 @@ int NanostackInterface::socket_connect(void *handle, const SocketAddress &addr)
return NSAPI_ERROR_NO_SOCKET;
}
if (addr.get_ip_version() != NSAPI_IPv6) {
return NSAPI_ERROR_UNSUPPORTED;
}
nanostack_lock();
int ret;