Don't crash when passing null destinations to bind, connect, and sendto
Passing a null address to bind or connect is invalid (for
AF_INET6 socekts, they return EINVAL), so throw NPE. Passing a
null address to sendto is valid and means "send to the address
this socket is connected to". Pass the call to the kernel as
the app would expect.
There should be no backwards compatibility implications to this
change because previously these operations would just crash with
a JNI error. See previous CL in topic.
Test: atest CtsLibcoreTestCases:libcore.libcore.io.OsTest#testCrossFamilyBindConnectSendto
2 files changed