Fix crash on invalid domain

This commit is contained in:
MysterD 2022-02-25 22:44:23 -08:00
parent d504ee6975
commit 49e48d4028

View file

@ -13,18 +13,22 @@
void domain_resolution(void) {
struct in_addr addr;
char *host_name;
char *host_name = configJoinIp;
struct hostent *remoteHost;
char* domainname = "";
host_name = configJoinIp;
if (host_name == NULL) {
return;
}
int i = 0;
remoteHost = gethostbyname(host_name);
i = 0;
if (remoteHost->h_addrtype == AF_INET) {
if (remoteHost == NULL) {
return;
}
if (remoteHost->h_addrtype == AF_INET) {
while (remoteHost->h_addr_list[i] != 0) {
addr.s_addr = *(u_long *) remoteHost->h_addr_list[i++];
domainname = inet_ntoa(addr);