mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Fix scan_includes matching the word "include" in strings.
This commit is contained in:
parent
12070ca500
commit
8efa0dcfb0
@ -48,9 +48,20 @@ void scan_file(char* filename) {
|
||||
buffer = strchr(buffer, '\n');
|
||||
if (!buffer) {
|
||||
fprintf(stderr, "%s: no newline at end of file\n", filename);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case '"':
|
||||
buffer++;
|
||||
buffer = strchr(buffer, '"');
|
||||
if (!buffer) {
|
||||
fprintf(stderr, "%s: unterminated string\n", filename);
|
||||
break;
|
||||
}
|
||||
buffer++;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
case 'I':
|
||||
if ((strncmp(buffer, "INCBIN", 6) == 0) || (strncmp(buffer, "incbin", 6) == 0)) {
|
||||
@ -60,9 +71,10 @@ void scan_file(char* filename) {
|
||||
}
|
||||
if (is_incbin || is_include) {
|
||||
buffer = strchr(buffer, '"');
|
||||
if (!buffer++) {
|
||||
if (!buffer) {
|
||||
break;
|
||||
}
|
||||
buffer++;
|
||||
int length = strcspn(buffer, "\"");
|
||||
char *include = malloc(length + 1);
|
||||
strncpy(include, buffer, length);
|
||||
|
Loading…
Reference in New Issue
Block a user