diff --git a/net/icmp/icmp_recvfrom.c b/net/icmp/icmp_recvfrom.c index f8cb5ca9ad..20ef214904 100644 --- a/net/icmp/icmp_recvfrom.c +++ b/net/icmp/icmp_recvfrom.c @@ -371,7 +371,7 @@ ssize_t icmp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, if (from != NULL) { - if (fromlen == NULL && *fromlen < sizeof(struct sockaddr_in)) + if (fromlen == NULL || *fromlen < sizeof(struct sockaddr_in)) { return -EINVAL; }