mirror of
https://github.com/soheilhy/cmux.git
synced 2025-09-17 20:20:20 +08:00
Fix index out of range in patricia tree
Bug #32 reported that there is an index out of range error. This
issue was introduced in 703b087
.
Fix #32 and add a test to detect this issue
This commit is contained in:
@@ -161,6 +161,10 @@ func (n *ptNode) match(b []byte, prefix bool) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
if l >= len(b) {
|
||||
return false
|
||||
}
|
||||
|
||||
nextN, ok := n.next[b[l]]
|
||||
if !ok {
|
||||
return false
|
||||
|
Reference in New Issue
Block a user