Browse Source

[text] TextLength() security check

Ray 5 năm trước cách đây
mục cha
commit
39e73ccc4d
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  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;
 }