From 997fa530056070bd6e8683f928e16fadb0b16b8b Mon Sep 17 00:00:00 2001 From: Mark Olsen Date: Fri, 30 Jun 2006 15:45:16 +0000 Subject: [PATCH] Fixed yet another remote buffer overflow. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2337 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/net_wins.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index b7ff18185..87eb91d8c 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -448,7 +448,7 @@ qboolean NET_StringToSockaddr (char *s, struct sockaddr_qstorage *sadr) else #endif #ifdef IPPROTO_IPV6 - if (pgetaddrinfo) + if (pgetaddrinfo) { struct addrinfo *addrinfo = NULL; struct addrinfo *pos; @@ -457,7 +457,7 @@ qboolean NET_StringToSockaddr (char *s, struct sockaddr_qstorage *sadr) char *port; char dupbase[256]; int len; - + memset(&udp6hint, 0, sizeof(udp6hint)); udp6hint.ai_family = 0;//Any... we check for AF_INET6 or 4 udp6hint.ai_socktype = SOCK_DGRAM; @@ -531,6 +531,9 @@ dblbreak: ((struct sockaddr_in *)sadr)->sin_port = 0; + if (strlen(s) >= sizeof(copy)-1) + return false; + strcpy (copy, s); // strip off a trailing :port if present for (colon = copy ; *colon ; colon++)