diff --git a/net/icmpv6/icmpv6_recvmsg.c b/net/icmpv6/icmpv6_recvmsg.c index b62ed757676..c7651c22bf7 100644 --- a/net/icmpv6/icmpv6_recvmsg.c +++ b/net/icmpv6/icmpv6_recvmsg.c @@ -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; }