Use strlcpy() instead of strncpy().
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2826 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
811fb3db90
commit
85c9f289a9
1 changed files with 6 additions and 6 deletions
|
@ -54,6 +54,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "qtv.h"
|
||||
|
||||
#include "bsd_string.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
@ -127,10 +129,9 @@ qboolean NET_StringToAddr (char *s, netadr_t *sadr, int defaultport)
|
|||
if (port)
|
||||
{
|
||||
len = port - s;
|
||||
if (len >= sizeof(dupbase))
|
||||
len = sizeof(dupbase)-1;
|
||||
strncpy(dupbase, s, len);
|
||||
dupbase[len] = '\0';
|
||||
if (len > sizeof(dupbase))
|
||||
len = sizeof(dupbase);
|
||||
strlcpy(dupbase, s, len);
|
||||
error = getaddrinfo(dupbase, port+1, &udp6hint, &addrinfo);
|
||||
}
|
||||
else
|
||||
|
@ -1331,8 +1332,7 @@ void QTV_ParseQWStream(sv_t *qtv)
|
|||
}
|
||||
if (buffer[4] == 'n')
|
||||
{
|
||||
strncpy(qtv->status, buffer+5, sizeof(qtv->status));
|
||||
qtv->status[sizeof(qtv->status)-1] = 0;
|
||||
strlcpy(qtv->status, buffer+5, sizeof(qtv->status));
|
||||
Sys_Printf(qtv->cluster, "%s: %s", qtv->server, buffer+5);
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue