mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 11:33:44 +01:00
Fix safeLoadFile() skipping 2 chars too much from the shebang (#13310)
This commit is contained in:
parent
baf99f826c
commit
2180dc14ef
@ -457,11 +457,10 @@ bool ScriptApiSecurity::safeLoadFile(lua_State *L, const char *path, const char
|
|||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
int c = std::getc(fp);
|
int c = std::getc(fp);
|
||||||
if (c == '#') {
|
if (c == '#') {
|
||||||
// Skip the first line
|
// Skip the shebang line (but keep line-ending)
|
||||||
while ((c = std::getc(fp)) != EOF && c != '\n') {}
|
while (c != EOF && c != '\n')
|
||||||
if (c == '\n')
|
c = std::getc(fp);
|
||||||
std::getc(fp);
|
start = std::ftell(fp) - 1;
|
||||||
start = std::ftell(fp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the file
|
// Read the file
|
||||||
|
Loading…
Reference in New Issue
Block a user