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 "qtv.h"
|
||||||
|
|
||||||
|
#include "bsd_string.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -127,10 +129,9 @@ qboolean NET_StringToAddr (char *s, netadr_t *sadr, int defaultport)
|
||||||
if (port)
|
if (port)
|
||||||
{
|
{
|
||||||
len = port - s;
|
len = port - s;
|
||||||
if (len >= sizeof(dupbase))
|
if (len > sizeof(dupbase))
|
||||||
len = sizeof(dupbase)-1;
|
len = sizeof(dupbase);
|
||||||
strncpy(dupbase, s, len);
|
strlcpy(dupbase, s, len);
|
||||||
dupbase[len] = '\0';
|
|
||||||
error = getaddrinfo(dupbase, port+1, &udp6hint, &addrinfo);
|
error = getaddrinfo(dupbase, port+1, &udp6hint, &addrinfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1331,8 +1332,7 @@ void QTV_ParseQWStream(sv_t *qtv)
|
||||||
}
|
}
|
||||||
if (buffer[4] == 'n')
|
if (buffer[4] == 'n')
|
||||||
{
|
{
|
||||||
strncpy(qtv->status, buffer+5, sizeof(qtv->status));
|
strlcpy(qtv->status, buffer+5, sizeof(qtv->status));
|
||||||
qtv->status[sizeof(qtv->status)-1] = 0;
|
|
||||||
Sys_Printf(qtv->cluster, "%s: %s", qtv->server, buffer+5);
|
Sys_Printf(qtv->cluster, "%s: %s", qtv->server, buffer+5);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue