diff --git a/src/graphics/model/model_output.cpp b/src/graphics/model/model_output.cpp
index 15ebeb7..ef94a3a 100644
--- a/src/graphics/model/model_output.cpp
+++ b/src/graphics/model/model_output.cpp
@@ -328,7 +328,10 @@ void ModelOutput::WriteOldModel(const CModel& model, std::ostream &stream)
t.material.ambient = triangle.ambient;
t.material.diffuse = triangle.diffuse;
t.material.specular = triangle.specular;
- strncpy(t.texName, triangle.tex1Name.c_str(), 20);
+
+ strncpy(t.texName, triangle.tex1Name.c_str(), sizeof(t.texName)-1);
+ t.texName[sizeof(t.texName)-1] = '\0';
+
t.min = 0.0f;
t.max = 1000000.0f;
t.state = ConvertToOldState(triangle);