mirror of
https://github.com/apache/nuttx.git
synced 2026-05-09 23:12:17 +08: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:
committed by
Alan C. Assis
parent
0c7f8204fd
commit
6cba2674fa
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user