Skip to content

Commit

Permalink
[Fix] fix issue #53
Browse files Browse the repository at this point in the history
  • Loading branch information
hengyoush committed Oct 1, 2024
1 parent 0857946 commit 7ad41d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions agent/protocol/mysql/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func DissectIntParam[T common.KInt](s string, offset *int, nbytes uint, param *s

func DissectInt[T common.KInt](msg string, offset *int, length int, result *T) bool {
if len(msg) < *offset+length {
common.ProtocolParserLog.Errorln("Not enough bytes to dissect int param.")
common.ProtocolParserLog.Warnln("Not enough bytes to dissect int param.")
return false
}
*result, _ = common.LEndianBytesToKInt[T]([]byte(msg[*offset:]), length)
Expand Down Expand Up @@ -190,7 +190,7 @@ func processLengthEncodedInt(s string, offset *int) (int64, bool) {

func DissectStringParam(s string, offset *int, param *string) bool {
param_length, ok := processLengthEncodedInt(s, offset)
if !ok {
if !ok || len(s) < *offset+int(param_length) {
return false
}
*param = s[*offset : *offset+int(param_length)]
Expand Down

0 comments on commit 7ad41d6

Please sign in to comment.