Added string termination

This commit is contained in:
Robert Osfield 2016-06-20 17:39:57 +01:00
parent 5e3c5a18c6
commit 26aa519803
2 changed files with 4 additions and 2 deletions

View File

@ -54,7 +54,7 @@ int32 trpgr_Archive::GetHeaderData(char *dataPtr, int length, FILE *filehandle)
// Set the directory where the archive is
void trpgr_Archive::SetDirectory(const char *in_dir)
{
strncpy(dir,in_dir,1024);
strncpy(dir,in_dir,DIR_SIZE-1); dir[DIR_SIZE-1] = 0;
}
// Open File

View File

@ -177,6 +177,8 @@ TX_EXDECL class TX_CLDECL trpgrImageHelper
bool separateGeoTyp;
};
#define DIR_SIZE 1024
/* Paging Archive (read version)
This just reads the first bits of the file (and the header)
and lets you parse from there.
@ -229,7 +231,7 @@ protected:
FILE *fp;
int fid;
// Header info
char dir[1024];
char dir[DIR_SIZE];
trpgHeader header;
trpgMatTable materialTable;
trpgTexTable texTable;