Fixes a crash experienced with IPV6 and the serverbrowser (assignment to static strings = not good plan)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@174 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
096d0f0973
commit
80975e0ce9
1 changed files with 8 additions and 3 deletions
|
@ -418,6 +418,8 @@ qboolean NET_StringToSockaddr (char *s, struct sockaddr_qstorage *sadr)
|
||||||
struct addrinfo udp6hint;
|
struct addrinfo udp6hint;
|
||||||
int error;
|
int error;
|
||||||
char *port;
|
char *port;
|
||||||
|
char dupbase[256];
|
||||||
|
int len;
|
||||||
|
|
||||||
memset(&udp6hint, 0, sizeof(udp6hint));
|
memset(&udp6hint, 0, sizeof(udp6hint));
|
||||||
udp6hint.ai_family = 0;//Any... AF_INET6;
|
udp6hint.ai_family = 0;//Any... AF_INET6;
|
||||||
|
@ -436,9 +438,12 @@ qboolean NET_StringToSockaddr (char *s, struct sockaddr_qstorage *sadr)
|
||||||
port = NULL;
|
port = NULL;
|
||||||
if (port)
|
if (port)
|
||||||
{
|
{
|
||||||
*port = '\0';
|
len = port - s;
|
||||||
error = pgetaddrinfo(s, port+1, &udp6hint, &addrinfo);
|
if (len >= sizeof(dupbase))
|
||||||
*port = ':';
|
len = sizeof(dupbase)-1;
|
||||||
|
strncpy(dupbase, s, len);
|
||||||
|
dupbase[len] = '\0';
|
||||||
|
error = pgetaddrinfo(dupbase, port+1, &udp6hint, &addrinfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error = EAI_NONAME;
|
error = EAI_NONAME;
|
||||||
|
|
Loading…
Reference in a new issue