net/icmp/icmp_recvfrom.c: fix a NULL dereference
Found by clang-check: icmp/icmp_recvfrom.c:374:30: warning: Dereference of null pointer (loaded from variable 'fromlen') if (fromlen == NULL && *fromlen < sizeof(struct sockaddr_in)) ^~~~~~~~ 1 warning generated.
This commit is contained in:
parent
1078210f7f
commit
bf9ba474a5
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue