return NULL;
}
/* get model's base name (eg. jeep from c:\models\jeep.3ds) */
- memset( basename,0,sizeof( basename ) );
- strncpy( basename,_pico_nopath( fileName ),sizeof( basename ) );
+ memset( basename, 0, sizeof( basename ) );
+ strncpy( basename, _pico_nopath( fileName ), sizeof( basename ) - 1 );
_pico_setfext( basename, NULL );
/* initialize persistant vars (formerly static) */
PicoSetModelFileName( model, fileName );
/* initialize some stuff */
- memset( lastNodeName,0,sizeof( lastNodeName ) );
+ memset( lastNodeName, 0, sizeof( lastNodeName ) );
/* parse ase model file */
while ( 1 )
}
/* remember node name */
- strncpy( lastNodeName,ptr,sizeof( lastNodeName ) );
+ strncpy( lastNodeName, ptr, sizeof( lastNodeName ) - 1 );
}
/* model mesh (originally contained within geomobject) */
else if ( !_pico_stricmp( p->token,"*mesh" ) ) {
fm_vert_normal_t *vert;
- char skinname[FM_SKINPATHSIZE];
+ char skinname[FM_SKINPATHSIZE + 1];
+ skinname[FM_SKINPATHSIZE] = '\0';
fm_t fm;
fm_header_t *fm_head;
fm_st_t *texCoord;
lwPolygon *pol;
lwPolVert *v;
lwVMapPt *vm;
- char name[ 256 ];
+ char name[256];
+ name[255] = '\0';
int i, j, k, numverts;
picoModel_t *picoModel;
}
/* detox and set shader name */
- strncpy( name, surface->name, sizeof( name ) );
+ strncpy( name, surface->name, sizeof( name ) - 1 );
_pico_first_token( name );
_pico_setfext( name, NULL );
_pico_unixify( name );
index_DUP_LUT_t *p_index_LUT_DUPS;
md2Triangle_t *p_md2Triangle;
- char skinname[ MD2_MAX_SKINNAME ];
+ char skinname[ MD2_MAX_SKINNAME + 1 ];
+ skinname[ MD2_MAX_SKINNAME] = '\0';
md2_t *md2;
md2St_t *texCoord;
md2Frame_t *frame;
char skinname[MD2_MAX_SKINNAME];
char skinnameRelative[MD2_MAX_SKINNAME];
- char path[MD2_MAX_SKINNAME];
+ char path[MD2_MAX_SKINNAME + 1];
+ path[MD2_MAX_SKINNAME] = '\0';
int i = MD2_MAX_SKINNAME;
PointerInputStream inputStream( buffer + header.ofs_skins );
inputStream.read( reinterpret_cast<byte*>( skinnameRelative ), MD2_MAX_SKINNAME );