net/socket: psock_send/psock_sendto: remove assert check for null psock and buf input pointers. Removes check as 'psock == NULL' altogether because that checked for later in psock_send and psock_sendto. Change null check for 'buf' so that it is handled same as in recvfrom.c (return -EINVAL instead of

assert).
This commit is contained in:
Jussi Kivilinna 2017-10-11 11:04:05 -06:00 committed by Gregory Nutt
parent b12f693b8b
commit 957831d2ba
2 changed files with 16 additions and 2 deletions

View File

@ -89,7 +89,14 @@ ssize_t psock_send(FAR struct socket *psock, FAR const void *buf, size_t len,
{
ssize_t ret;
DEBUGASSERT(psock != NULL && buf != NULL);
/* Verify that non-NULL pointers were passed */
#ifdef CONFIG_DEBUG_FEATURES
if (buf == NULL)
{
return -EINVAL;
}
#endif
/* Verify that the sockfd corresponds to valid, allocated socket */

View File

@ -124,7 +124,14 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
{
ssize_t nsent;
DEBUGASSERT(psock != NULL && buf != NULL);
/* Verify that non-NULL pointers were passed */
#ifdef CONFIG_DEBUG_FEATURES
if (buf == NULL)
{
return -EINVAL;
}
#endif
/* If to is NULL or tolen is zero, then this function is same as send (for
* connected socket types)