mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-18 09:18:15 +00:00
REVIEW: TextSplit()
Just adding a security check
This commit is contained in:
@@ -1372,7 +1372,11 @@ const char **TextSplit(const char *text, char delimiter, int *count)
|
|||||||
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
||||||
|
|
||||||
result[0] = buffer;
|
result[0] = buffer;
|
||||||
int counter = 1;
|
int counter = 0;
|
||||||
|
|
||||||
|
if (text != NULL)
|
||||||
|
{
|
||||||
|
counter = 1;
|
||||||
|
|
||||||
// Count how many substrings we have on text and point to every one
|
// Count how many substrings we have on text and point to every one
|
||||||
for (int i = 0; i < MAX_TEXT_BUFFER_LENGTH; i++)
|
for (int i = 0; i < MAX_TEXT_BUFFER_LENGTH; i++)
|
||||||
@@ -1388,6 +1392,7 @@ const char **TextSplit(const char *text, char delimiter, int *count)
|
|||||||
if (counter == MAX_SUBSTRINGS_COUNT) break;
|
if (counter == MAX_SUBSTRINGS_COUNT) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*count = counter;
|
*count = counter;
|
||||||
return result;
|
return result;
|
||||||
|
Reference in New Issue
Block a user