Bugfix: fast path for empty magic
This commit is contained in:
@@ -9,6 +9,9 @@ package protocol
|
||||
//
|
||||
// Returns true if all magic bytes are matched, even if input has extra bytes.
|
||||
func Match(magic string, input []byte) bool {
|
||||
if len(magic) == 0 {
|
||||
return true
|
||||
}
|
||||
return match(magic, input, 0, 0)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user