From ad0a487646a4a55339e906607aa769f5596b3c52 Mon Sep 17 00:00:00 2001
From: Kim Kulling <kim.kulling@googlemail.com>
Date: Sat, 29 Mar 2025 11:42:41 +0100
Subject: [PATCH 1/2] Fix set

---
 include/assimp/types.h | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/include/assimp/types.h b/include/assimp/types.h
index 920f7fa7a1..6f49a7e299 100644
--- a/include/assimp/types.h
+++ b/include/assimp/types.h
@@ -303,10 +303,19 @@ struct aiString {
     }
 
     /** Copy a const char* to the aiString */
-    void Set(const char *sz) {
-        ai_int32 len = (ai_uint32)::strlen(sz);
-        if (len > static_cast<ai_int32>(AI_MAXLEN - 1)) {
-            len = static_cast<ai_int32>(AI_MAXLEN - 1);
+    void Set(const char *sz, size_t maxlen) {
+        if (sz == nullptr) {
+            return;
+        }
+        size_t len = 0;
+        for (size_t i=0; i<maxlen; ++i) {
+            if (sz[i] == '\0') {
+                break;
+            }
+            ++len;
+        }
+        if (len > AI_MAXLEN - 1) {
+            len = AI_MAXLEN - 1;
         }
         length = len;
         memcpy(data, sz, len);

From 7c7bf085f695c592484af731f5fc6fd4b834b4b1 Mon Sep 17 00:00:00 2001
From: Kim Kulling <kim.kulling@googlemail.com>
Date: Tue, 8 Apr 2025 12:54:22 +0200
Subject: [PATCH 2/2] Fix: Fix implicite cast from size_t to uint32_t

---
 include/assimp/types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/assimp/types.h b/include/assimp/types.h
index 6f49a7e299..f2da91d4f8 100644
--- a/include/assimp/types.h
+++ b/include/assimp/types.h
@@ -317,7 +317,7 @@ struct aiString {
         if (len > AI_MAXLEN - 1) {
             len = AI_MAXLEN - 1;
         }
-        length = len;
+        length = static_cast<uint32_t>(len);
         memcpy(data, sz, len);
         data[len] = 0;
     }
