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:
zhanghongyu
2026-04-13 14:36:14 +08:00
committed by Alan C. Assis
parent 0c7f8204fd
commit 6cba2674fa
+1 -1
View File
@@ -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;
}