diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-08-06 16:01:57 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-08-06 16:01:57 +0300 |
commit | 2796ee7da049bbea3d83efdd42c3eaf1af1ebb2c (patch) | |
tree | 852d7e6b27f97af2305fb3c2649e994a81662f5f /source | |
parent | 01c1b1e82e5f59ea84686f7756086f0421e93c5f (diff) |
Fix error setting the ID name in disabled alembic nurbs importe
This corrects code that's currently disabled, see `USE_NURBS` define.
The name passed to `BKE_curve_add` was overwritten,
bypassing uniqueness and utf8 encoding checks.
Longer names would cause a buffer overrun as the length of the source
data was passed to `BLI_strncpy` instead of the destination.
Reviewed By: sybren
Ref D12125
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/io/alembic/intern/abc_reader_nurbs.cc | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/source/blender/io/alembic/intern/abc_reader_nurbs.cc b/source/blender/io/alembic/intern/abc_reader_nurbs.cc index 2a5f4ecb787..25567aa8c24 100644 --- a/source/blender/io/alembic/intern/abc_reader_nurbs.cc +++ b/source/blender/io/alembic/intern/abc_reader_nurbs.cc @@ -90,7 +90,7 @@ static bool set_knots(const FloatArraySamplePtr &knots, float *&nu_knots) void AbcNurbsReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) { - Curve *cu = static_cast<Curve *>(BKE_curve_add(bmain, "abc_curve", OB_SURF)); + Curve *cu = static_cast<Curve *>(BKE_curve_add(bmain, m_data_name.c_str(), OB_SURF)); cu->actvert = CU_ACT_NONE; std::vector<std::pair<INuPatchSchema, IObject>>::iterator it; @@ -180,8 +180,6 @@ void AbcNurbsReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSele BLI_addtail(BKE_curve_nurbs_get(cu), nu); } - BLI_strncpy(cu->id.name + 2, m_data_name.c_str(), m_data_name.size() + 1); - m_object = BKE_object_add_only_object(bmain, OB_SURF, m_object_name.c_str()); m_object->data = cu; } |