Skip to content

Commit 95798c4

Browse files
authored
fix: slice field marshaling out of bound (#3184)
1 parent 9f7d740 commit 95798c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/gofields/gofields.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func getValue(value reflect.Value, parents []string, path []string) (reflect.Val
4949
if err != nil {
5050
return reflect.Value{}, fmt.Errorf("trying to access array %s but %s is not a numerical index", strings.Join(parents, "."), path[0])
5151
}
52-
if idx > value.Len() {
52+
if idx >= value.Len() {
5353
return reflect.Value{}, fmt.Errorf("trying to access array %s but %d is out of range", strings.Join(parents, "."), idx)
5454
}
5555
return getValue(value.Index(idx), append(parents, path[0]), path[1:])

0 commit comments

Comments
 (0)