mirror of https://github.com/mgba-emu/mgba.git
Scripting: Bucket names can't start with .
This commit is contained in:
parent
3139ac7d58
commit
b1faf67438
|
@ -508,15 +508,22 @@ struct mScriptStorageBucket* mScriptStorageGetBucket(struct mScriptStorageContex
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if name is allowed
|
// Check if name is allowed
|
||||||
// Currently only names matching /[0-9A-Za-z_.]+/ are allowed
|
// Currently only names matching /[0-9A-Za-z][0-9A-Za-z_.]*/ are allowed
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; name[i]; ++i) {
|
for (i = 0; name[i]; ++i) {
|
||||||
if (i >= STORAGE_LEN_MAX) {
|
if (i >= STORAGE_LEN_MAX) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!isalnum(name[i]) && name[i] != '_' && name[i] != '.') {
|
if (isalnum(name[i])) {
|
||||||
return NULL;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (name[i] == '_') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (i > 0 && name[i] == '.') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
struct mScriptStorageBucket* bucket = HashTableLookup(&storage->buckets, name);
|
struct mScriptStorageBucket* bucket = HashTableLookup(&storage->buckets, name);
|
||||||
if (bucket) {
|
if (bucket) {
|
||||||
|
|
Loading…
Reference in New Issue