瀏覽代碼

[text] TextLength() security check

Ray 5 年之前
父節點
當前提交
39e73ccc4d
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/text.c

+ 4 - 1
src/text.c

@@ -1147,7 +1147,10 @@ unsigned int TextLength(const char *text)
 {
     unsigned int length = 0; //strlen(text)
 
-    while (*text++) length++;
+    if (text != NULL)
+    {
+        while (*text++) length++;
+    }
 
     return length;
 }