diff options
| author | Peter0x44 <[email protected]> | 2024-05-15 07:16:45 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-05-15 16:16:45 +0200 |
| commit | bf5eecc71f63d1bca76fdb377a1d231066f9258d (patch) | |
| tree | 904dca6117908cce7ddcc52502ed7023e333981b /parser/raylib_parser.c | |
| parent | 3d885ef9195825b03c9657f136293077e61ee503 (diff) | |
| download | raylib-bf5eecc71f63d1bca76fdb377a1d231066f9258d.tar.gz raylib-bf5eecc71f63d1bca76fdb377a1d231066f9258d.zip | |
[parser] Don't crash for files that don't end in newlines (#3981)
The parser assumes all lines end in newlines, but sometimes this isn't
true. Check for a null terminator along with '\n' when stripping leading
spaces.
Diffstat (limited to 'parser/raylib_parser.c')
| -rw-r--r-- | parser/raylib_parser.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/parser/raylib_parser.c b/parser/raylib_parser.c index ec1d490e..3e36f41f 100644 --- a/parser/raylib_parser.c +++ b/parser/raylib_parser.c @@ -1243,7 +1243,7 @@ static char **GetTextLines(const char *buffer, int length, int *linesCount) while ((bufferPtr[index] == ' ') || (bufferPtr[index] == '\t')) index++; int j = 0; - while (bufferPtr[index + j] != '\n') + while (bufferPtr[index + j] != '\n' && bufferPtr[index + j] != '\0') { lines[i][j] = bufferPtr[index + j]; j++; |
