recv() and recvfrom() return int, do not prematurely cast the return value.
This commit is contained in:
parent
0bfd69a273
commit
74e50d52e0
2 changed files with 7 additions and 4 deletions
|
|
@ -533,15 +533,18 @@ void handle_incoming_vpn_data(int sock, short events, void *data) {
|
|||
sockaddr_t from;
|
||||
socklen_t fromlen = sizeof from;
|
||||
node_t *n;
|
||||
int len;
|
||||
|
||||
pkt.len = recvfrom(sock, (char *) &pkt.seqno, MAXSIZE, 0, &from.sa, &fromlen);
|
||||
len = recvfrom(sock, (char *) &pkt.seqno, MAXSIZE, 0, &from.sa, &fromlen);
|
||||
|
||||
if(pkt.len < 0) {
|
||||
if(len <= 0 || len > MAXSIZE) {
|
||||
if(!sockwouldblock(sockerrno))
|
||||
logger(LOG_ERR, "Receiving packet failed: %s", sockstrerror(sockerrno));
|
||||
return;
|
||||
}
|
||||
|
||||
pkt.len = len;
|
||||
|
||||
sockaddrunmap(&from); /* Some braindead IPv6 implementations do stupid things. */
|
||||
|
||||
n = lookup_node_udp(&from);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue