Config: Fix panic on invalid lua-shared-dict. (#12281)
This commit is contained in:
parent
440575e151
commit
ac23d4069b
2 changed files with 10 additions and 2 deletions
|
|
@ -125,8 +125,11 @@ func ReadConfig(src map[string]string) config.Configuration {
|
|||
delete(conf, luaSharedDictsKey)
|
||||
lsd := splitAndTrimSpace(val, ",")
|
||||
for _, v := range lsd {
|
||||
v = strings.ReplaceAll(v, " ", "")
|
||||
results := strings.SplitN(v, ":", 2)
|
||||
results := strings.SplitN(strings.ReplaceAll(v, " ", ""), ":", 2)
|
||||
if len(results) != 2 {
|
||||
klog.Errorf("Ignoring poorly formatted Lua dictionary %v", v)
|
||||
continue
|
||||
}
|
||||
dictName := results[0]
|
||||
size := dictStrToKb(results[1])
|
||||
if size < 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue