net/can/can_setsockopt.c: fix assertion, value can be NULL

This commit is contained in:
raiden00pl 2022-02-12 22:27:52 +01:00 committed by Xiang Xiao
parent 70dae3bb3b
commit 5b678ab12e
1 changed files with 5 additions and 3 deletions

View File

@ -76,7 +76,9 @@ int can_setsockopt(FAR struct socket *psock, int option,
int ret = OK; int ret = OK;
int count = 0; int count = 0;
DEBUGASSERT(psock != NULL && value != NULL && psock->s_conn != NULL); DEBUGASSERT(psock != NULL && psock->s_conn != NULL);
DEBUGASSERT(value_len == 0 || value != NULL);
conn = (FAR struct can_conn_s *)psock->s_conn; conn = (FAR struct can_conn_s *)psock->s_conn;
if (psock->s_type != SOCK_RAW) if (psock->s_type != SOCK_RAW)
@ -147,9 +149,9 @@ int can_setsockopt(FAR struct socket *psock, int option,
return -EINVAL; return -EINVAL;
} }
conn->fd_frames = *(FAR int32_t *)value; conn->fd_frames = *(FAR int32_t *)value;
break; break;
#endif #endif
case CAN_RAW_JOIN_FILTERS: case CAN_RAW_JOIN_FILTERS: