Skip to content

Commit

Permalink
broadcast addr can be NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
th-otto committed Mar 16, 2024
1 parent 83c8956 commit 2450d58
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions common/wspudp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,15 @@ bool UDPInterfaceClass::Open_Socket(SOCKET)
*((uint32_t*)a) = tmp_addr->s_addr;
LocalAddresses.Add(a);

tmp_addr = &((struct sockaddr_in*)ifa->ifa_broadaddr)->sin_addr;
inet_ntop(AF_INET, tmp_addr, buf, INET_ADDRSTRLEN);
sprintf(temp, "RA95: Using broadcast address of: %s\n", buf);
fprintf(stderr, temp);
Set_Broadcast_Address(buf);
if ((struct sockaddr_in*)ifa->ifa_broadaddr == 0) {
fprintf(stderr, "RA95: No broadcast address\n");
} else {
tmp_addr = &((struct sockaddr_in*)ifa->ifa_broadaddr)->sin_addr;
inet_ntop(AF_INET, tmp_addr, buf, INET_ADDRSTRLEN);
sprintf(temp, "RA95: Using broadcast address of: %s\n", buf);
fprintf(stderr, temp);
Set_Broadcast_Address(buf);
}
}
}

Expand Down

0 comments on commit 2450d58

Please sign in to comment.