config: Fix crash in overlay()
if len(src) > len(dest), then we hit an out-of-bounds crash accessing dest[i].
It is totally valid to have src and dest with different lens, as you may
want to override only part of the list.
Change-Id: I4f8a191810e89a4081199edcb390fb3bb27ed42f
diff --git a/src/osmo_gsm_tester/config.py b/src/osmo_gsm_tester/config.py
index 0721c30..7f1e52f 100644
--- a/src/osmo_gsm_tester/config.py
+++ b/src/osmo_gsm_tester/config.py
@@ -281,9 +281,12 @@
if is_list(dest):
if not is_list(src):
raise ValueError('cannot combine list with a value of type: %r' % type(src))
- for i in range(len(src)):
+ copy_len = min(len(src),len(dest))
+ for i in range(copy_len):
log.ctx(idx=i)
dest[i] = overlay(dest[i], src[i])
+ for i in range(copy_len, len(src)):
+ dest.append(src[i])
return dest
return src