Remove strcpy. (#5802)
* Remove strcpy. * Sonarcube: Add more strcpy replacements * BlenderLoader: Replace strncpy by memcpy
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
|
||||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -495,8 +493,9 @@ void BlenderImporter::BuildDefaultMaterial(Blender::ConversionData &conv_data) {
|
||||
if (index == static_cast<unsigned int>(-1)) {
|
||||
// Setup a default material.
|
||||
std::shared_ptr<Material> p(new Material());
|
||||
ai_assert(::strlen(AI_DEFAULT_MATERIAL_NAME) < sizeof(p->id.name) - 2);
|
||||
strcpy(p->id.name + 2, AI_DEFAULT_MATERIAL_NAME);
|
||||
const size_t len = ::strlen(AI_DEFAULT_MATERIAL_NAME);
|
||||
ai_assert(len < sizeof(p->id.name) - 2);
|
||||
memcpy(p->id.name + 2, AI_DEFAULT_MATERIAL_NAME, len);
|
||||
|
||||
// Note: MSVC11 does not zero-initialize Material here, although it should.
|
||||
// Thus all relevant fields should be explicitly initialized. We cannot add
|
||||
|
||||
Reference in New Issue
Block a user