aboutsummaryrefslogtreecommitdiff
path: root/syncapi/types
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-02-17 13:25:41 +0000
committerGitHub <noreply@github.com>2022-02-17 13:25:41 +0000
commit353168a9e93803bc9c5608d2e0ec55ba7fc581d9 (patch)
treef3d0bd97d6587e98f2b385c828bbe722caf4a93d /syncapi/types
parent89b7519089d4dbebfb5222c7a3e969d6e4786248 (diff)
Fix potential panic in `NewStreamTokenFromString` caused by off-by-one error (#2196)
Line 291 could panic when trying to set `positions[i]` if `i == len(positions)`.
Diffstat (limited to 'syncapi/types')
-rw-r--r--syncapi/types/types.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/syncapi/types/types.go b/syncapi/types/types.go
index 68c308d8..c2e8ed01 100644
--- a/syncapi/types/types.go
+++ b/syncapi/types/types.go
@@ -279,7 +279,7 @@ func NewStreamTokenFromString(tok string) (token StreamingToken, err error) {
parts := strings.Split(tok[1:], "_")
var positions [7]StreamPosition
for i, p := range parts {
- if i > len(positions) {
+ if i >= len(positions) {
break
}
var pos int