[#493] node/config: Fix corrupting of path to the subsection

In previous implementation `Config.Sub` method could lead to the violation
of the internal `path` slice because of `append`. This has been observed on
deeply nested subsections.

Fix `Config.Sub` to copy internal slice in order to prevent violations.
Cover problem case in test config files and unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-01 20:12:00 +03:00 committed by Leonard Lyubich
parent 72d81dba92
commit e26dc0a6e3
4 changed files with 46 additions and 2 deletions

View file

@ -1,7 +1,18 @@
{
"value": "some value",
"section": {
"any": "thing"
"any": "thing",
"sub": {
"sub": {
"sub1": {
"key": "val1"
},
"sub2": {
"key": "val2"
}
}
}
},
"string_slice": {

View file

@ -3,6 +3,14 @@ value: some value
section:
any: thing
sub:
sub:
sub1:
key: val1
sub2:
key: val2
string_slice:
empty: []