mirror of https://github.com/mgba-emu/mgba.git
Scripting: Re-fix some Lua string handling (fixes #2877)
This commit is contained in:
parent
dfb6055ae4
commit
3f108aae75
|
@ -911,7 +911,11 @@ bool _luaLoad(struct mScriptEngineContext* ctx, const char* filename, struct VFi
|
|||
lastSlash = lastBackslash;
|
||||
}
|
||||
if (lastSlash) {
|
||||
strlcpy(dirname, filename, lastSlash - filename);
|
||||
size_t len = lastSlash - filename + 1;
|
||||
if (sizeof(dirname) < len) {
|
||||
len = sizeof(dirname);
|
||||
}
|
||||
strlcpy(dirname, filename, len);
|
||||
}
|
||||
snprintf(name, sizeof(name), "@%s", filename);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue