Skip to content

Commit

Permalink
[Coverity]: Argument cannot be negative
Browse files Browse the repository at this point in the history
Added validation to check for the negetive value of sMLDMonitorFd, as
setsockopt parameter cannot be negative
  • Loading branch information
hastigondaliya committed Sep 22, 2023
1 parent 85aff45 commit 85eec20
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/posix/platform/netif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1725,6 +1725,8 @@ static void mldListenerInit(void)
struct ipv6_mreq mreq6;

sMLDMonitorFd = SocketWithCloseExec(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6, kSocketNonBlock);
VerifyOrDie(sMLDMonitorFd != -1, OT_EXIT_FAILURE);

mreq6.ipv6mr_interface = gNetifIndex;
memcpy(&mreq6.ipv6mr_multiaddr, kMLDv2MulticastAddress.mFields.m8, sizeof(kMLDv2MulticastAddress.mFields.m8));

Expand Down

0 comments on commit 85eec20

Please sign in to comment.