mirror of
https://github.com/bluenviron/mediamtx
synced 2025-02-26 00:20:36 +00:00
confenv: fix possible crash
This commit is contained in:
parent
e724c3ba1e
commit
14efc103ba
@ -70,12 +70,16 @@ func process(env map[string]string, envKey string, rv reflect.Value) error {
|
||||
|
||||
case reflect.Map:
|
||||
for k := range env {
|
||||
if !strings.HasPrefix(k, envKey) {
|
||||
if !strings.HasPrefix(k, envKey+"_") {
|
||||
continue
|
||||
}
|
||||
|
||||
tmp := strings.Split(strings.TrimPrefix(k[len(envKey):], "_"), "_")
|
||||
mapKey := strings.ToLower(tmp[0])
|
||||
tmp := strings.Split(k[len(envKey+"_"):], "_")
|
||||
mapKey := tmp[0]
|
||||
if len(mapKey) == 0 {
|
||||
continue
|
||||
}
|
||||
mapKey = strings.ToLower(mapKey)
|
||||
|
||||
nv := rv.MapIndex(reflect.ValueOf(mapKey))
|
||||
zero := reflect.Value{}
|
||||
|
Loading…
Reference in New Issue
Block a user