mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-01-31 12:40:43 +00:00
Use strlcpy() instead of strncpy().
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2825 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
0ecc551f45
commit
811fb3db90
1 changed files with 3 additions and 2 deletions
|
@ -4,6 +4,7 @@ Contains the control routines that handle both incoming and outgoing stuff
|
|||
|
||||
#include "qtv.h"
|
||||
#include <signal.h>
|
||||
#include "bsd_string.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/stat.h>
|
||||
|
@ -194,7 +195,7 @@ void Cluster_BuildAvailableDemoList(cluster_t *cluster)
|
|||
{
|
||||
if (cluster->availdemoscount == sizeof(cluster->availdemos)/sizeof(cluster->availdemos[0]))
|
||||
break;
|
||||
strncpy(cluster->availdemos[cluster->availdemoscount].name, ffd.cFileName, sizeof(cluster->availdemos[0].name));
|
||||
strlcpy(cluster->availdemos[cluster->availdemoscount].name, ffd.cFileName, sizeof(cluster->availdemos[0].name));
|
||||
cluster->availdemos[cluster->availdemoscount].size = ffd.nFileSizeLow;
|
||||
cluster->availdemos[cluster->availdemoscount].time = ffd.ftLastWriteTime.dwHighDateTime;
|
||||
cluster->availdemos[cluster->availdemoscount].smalltime = ffd.ftLastWriteTime.dwLowDateTime;
|
||||
|
@ -222,7 +223,7 @@ void Cluster_BuildAvailableDemoList(cluster_t *cluster)
|
|||
snprintf(fullname, sizeof(fullname), "%s%s", cluster->demodir, ent->d_name);
|
||||
if (stat(fullname, &sb))
|
||||
continue; //some kind of error
|
||||
strncpy(cluster->availdemos[cluster->availdemoscount].name, ent->d_name, sizeof(cluster->availdemos[0].name));
|
||||
strlcpy(cluster->availdemos[cluster->availdemoscount].name, ent->d_name, sizeof(cluster->availdemos[0].name));
|
||||
cluster->availdemos[cluster->availdemoscount].size = sb.st_size;
|
||||
cluster->availdemos[cluster->availdemoscount].time = sb.st_mtime;
|
||||
cluster->availdemoscount++;
|
||||
|
|
Loading…
Reference in a new issue