1
0
Fork 0

In net_send() check if an raddr struct is set.

This commit is contained in:
Alexander Andreev 2024-03-24 16:35:04 +04:00
parent e5c6f23cfb
commit 43d5bdfe80
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34
1 changed files with 1 additions and 1 deletions

View File

@ -52,7 +52,7 @@ void net_destroy(net_t *n) {
}
int net_send(net_t *const n, const char *const buf, const int buf_len) {
if (n->fd == -1)
if (n->fd == -1 || n->raddr.sin_addr.s_addr == 0)
return -1;
if (sendto(n->fd, buf, buf_len, 0, (struct sockaddr *)&n->raddr, sizeof(n->raddr)) == -1)