Procházet zdrojové kódy

[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.
pull/3983/head
Peter0x44 před 9 měsíci
odevzdal GitHub
rodič
revize
bf5eecc71f
V databázi nebyl nalezen žádný známý klíč pro tento podpis ID GPG klíče: B5690EEEBB952194
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. +1
    -1
      parser/raylib_parser.c

+ 1
- 1
parser/raylib_parser.c Zobrazit soubor

@ -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++;

Načítá se…
Zrušit
Uložit