sprintf: replace sprintf by snprintf.

This commit is contained in:
Kim Kulling
2016-01-04 20:24:51 +01:00
parent f4d3d15bbb
commit c9d00beab8
3 changed files with 8 additions and 8 deletions

View File

@@ -211,7 +211,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
// Generate a default name for both the light source and the node
// FIXME - what's the right way to print a size_t? Is 'zu' universally available? stick with the safe version.
light->mName.length = ::sprintf(light->mName.data,"ACLight_%i",static_cast<unsigned int>(mLights->size())-1);
light->mName.length = ::snprintf(light->mName.data, MAXLEN, "ACLight_%i",static_cast<unsigned int>(mLights->size())-1);
obj.name = std::string( light->mName.data );
DefaultLogger::get()->debug("AC3D: Light source encountered");
@@ -733,13 +733,13 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
switch (object.type)
{
case Object::Group:
node->mName.length = ::sprintf(node->mName.data,"ACGroup_%i",groups++);
node->mName.length = ::snprintf(node->mName.data, MAXLEN, "ACGroup_%i",groups++);
break;
case Object::Poly:
node->mName.length = ::sprintf(node->mName.data,"ACPoly_%i",polys++);
node->mName.length = ::snprintf(node->mName.data, MAXLEN, "ACPoly_%i",polys++);
break;
case Object::Light:
node->mName.length = ::sprintf(node->mName.data,"ACLight_%i",lights++);
node->mName.length = ::snprintf(node->mName.data, MAXLEN, "ACLight_%i",lights++);
break;
// there shouldn't be more than one world, but we don't care