mirror of
https://github.com/glest/glest-source.git
synced 2025-08-29 10:49:48 +02:00
- round #2 of coverity bug fixes
This commit is contained in:
@@ -130,7 +130,7 @@ int g3d2xml(FILE *infile, FILE *outfile)
|
||||
struct ModelHeader modelHeader;
|
||||
struct MeshHeader meshHeader;
|
||||
size_t nBytes;
|
||||
uint8 textureName[NAMESIZE];
|
||||
uint8 textureName[NAMESIZE+1];
|
||||
float32 *fdata;
|
||||
uint32 *idata;
|
||||
unsigned int ii, jj, kk;
|
||||
@@ -226,7 +226,8 @@ int g3d2xml(FILE *infile, FILE *outfile)
|
||||
/* read / write the texture name if present */
|
||||
if (meshHeader.textures)
|
||||
{
|
||||
nBytes = sizeof(textureName);
|
||||
memset(&textureName[0],0,NAMESIZE+1);
|
||||
nBytes = NAMESIZE;
|
||||
if (fread(&textureName, nBytes, 1, infile) != 1)
|
||||
{
|
||||
printf("Could not read texture name!\n");
|
||||
|
@@ -245,7 +245,7 @@ int processMesh(xmlNode *n, FILE *outfile)
|
||||
float32 color[3];
|
||||
|
||||
struct MeshHeader mh;
|
||||
uint8 texname[NAMESIZE];
|
||||
uint8 texname[NAMESIZE+1];
|
||||
|
||||
int foundFlag = FALSE;
|
||||
xmlNode *texn = NULL;
|
||||
@@ -304,7 +304,7 @@ int processMesh(xmlNode *n, FILE *outfile)
|
||||
printf("Could not find <Texture> element!\n");
|
||||
return FALSE;
|
||||
}
|
||||
memset(texname, 0, NAMESIZE);
|
||||
memset(texname, 0, NAMESIZE+1);
|
||||
strncpy((char*)texname,
|
||||
(char*)xmlGetProp(texn, (xmlChar*)"name"), NAMESIZE);
|
||||
fwrite(texname, NAMESIZE, 1, outfile);
|
||||
|
Reference in New Issue
Block a user