Fixed mssql token parse

This commit is contained in:
solar 2019-03-05 17:55:20 +08:00
parent 33c0a0dfe4
commit de389e8c30
1 changed files with 6 additions and 4 deletions

View File

@ -27,15 +27,17 @@ const (
func parseToken(buf []byte) string { func parseToken(buf []byte) string {
var pos = 0 var pos = 0
len := 0 length := 0
for { for {
if len(buf) < pos+1 {
break
}
token := token(buf[pos]) token := token(buf[pos])
switch token { switch token {
case tokenSSPI: case tokenSSPI:
pos += 1 pos += 1
len = int(binary.LittleEndian.Uint16(buf[pos+1 : pos+2])) length = int(binary.LittleEndian.Uint16(buf[pos+1 : pos+2]))
pos += len pos += length
} }
break break