mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
net/icmpv6: fix wrong logical operator in recvmsg validation
Change && to || in the fromlen validation of icmpv6_recvmsg(). The original condition (fromlen == NULL && *fromlen < sizeof(...)) would never be true when fromlen is NULL due to short-circuit evaluation. The correct logic is: reject if fromlen is NULL or the buffer is too small. Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
0c7f8204fd
commit
6cba2674fa
1 changed files with 1 additions and 1 deletions
|
|
@ -325,7 +325,7 @@ ssize_t icmpv6_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
|
|||
|
||||
if (from != NULL)
|
||||
{
|
||||
if (fromlen == NULL && *fromlen < sizeof(struct sockaddr_in6))
|
||||
if (fromlen == NULL || *fromlen < sizeof(struct sockaddr_in6))
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue