--- parser3/src/main/pa_dir.C 2001/04/09 08:55:30 1.2 +++ parser3/src/main/pa_dir.C 2001/08/28 10:30:28 1.6 @@ -4,11 +4,9 @@ Copyright (c) 2000,2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - - $Id: pa_dir.C,v 1.2 2001/04/09 08:55:30 paf Exp $ */ +static const char *RCSId="$Id: pa_dir.C,v 1.6 2001/08/28 10:30:28 parser Exp $"; -#include "pa_config_includes.h" #include "pa_dir.h" #include "pa_common.h" @@ -32,7 +30,7 @@ void findclose(struct ffblk *_ffblk) { #else bool findfirst(const char *_pathname, struct ffblk *_ffblk, int _attrib) { - strncpy(_ffblk->filePath, _pathname, MAXPATH); + strncpy(_ffblk->filePath, _pathname, MAXPATH-1); _ffblk->filePath[MAXPATH-1]=0; if(!(_ffblk->dir=opendir(_ffblk->filePath))) return true; @@ -46,8 +44,7 @@ bool findnext(struct ffblk *_ffblk) { return true; int maxsize=sizeof(_ffblk->ff_name)-1; - strncpy(_ffblk->ff_name, entry->d_name, maxsize); - _ffblk->ff_name[maxsize]=0; + strncpy(_ffblk->ff_name, entry->d_name, maxsize-1); _ffblk->ff_name[maxsize]=0; char fileSpec[MAXPATH]; snprintf(fileSpec, MAXPATH, "%s/%s",