mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
c9f9ffa583
commit
8e5391ab85
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue