From 811fb3db90cc2c9e129afa54cdcb3e4c298d7909 Mon Sep 17 00:00:00 2001 From: Mark Olsen Date: Thu, 27 Dec 2007 15:20:24 +0000 Subject: [PATCH] Use strlcpy() instead of strncpy(). git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2825 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- fteqtv/control.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fteqtv/control.c b/fteqtv/control.c index e356d6e26..bfec201af 100644 --- a/fteqtv/control.c +++ b/fteqtv/control.c @@ -4,6 +4,7 @@ Contains the control routines that handle both incoming and outgoing stuff #include "qtv.h" #include +#include "bsd_string.h" #ifndef _WIN32 #include @@ -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++;