mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 11:41:38 +00:00
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)`.
This commit is contained in:
parent
89b7519089
commit
353168a9e9
@ -279,7 +279,7 @@ func NewStreamTokenFromString(tok string) (token StreamingToken, err error) {
|
|||||||
parts := strings.Split(tok[1:], "_")
|
parts := strings.Split(tok[1:], "_")
|
||||||
var positions [7]StreamPosition
|
var positions [7]StreamPosition
|
||||||
for i, p := range parts {
|
for i, p := range parts {
|
||||||
if i > len(positions) {
|
if i >= len(positions) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
var pos int
|
var pos int
|
||||||
|
Loading…
Reference in New Issue
Block a user