SCP/SOCKET: Apply default host more reasonably when parsing host:port strings
This commit is contained in:
parent
55c5d20517
commit
beac643acb
1 changed files with 14 additions and 1 deletions
15
sim_sock.c
15
sim_sock.c
|
@ -604,7 +604,20 @@ if (host) /* host wanted? */
|
|||
if (strlen(hostp) >= host_len)
|
||||
return SCPE_ARG; /* no room */
|
||||
else
|
||||
strcpy (host, hostp);
|
||||
if (('\0' != hostp[0]) || (default_host == NULL))
|
||||
strcpy (host, hostp);
|
||||
else
|
||||
if (strlen(default_host) >= host_len)
|
||||
return SCPE_ARG; /* no room */
|
||||
else
|
||||
strcpy (host, default_host);
|
||||
}
|
||||
else {
|
||||
if (default_host)
|
||||
if (strlen(default_host) >= host_len)
|
||||
return SCPE_ARG; /* no room */
|
||||
else
|
||||
strcpy (host, default_host);
|
||||
}
|
||||
if (validate_addr) {
|
||||
struct addrinfo *ai_host, *ai_validate, *ai;
|
||||
|
|
Loading…
Add table
Reference in a new issue