Skip to content

Commit

Permalink
fix: fix mysql protcol parser array index out of range issue and gotl…
Browse files Browse the repository at this point in the history
…s load failed issue (#246)

* fix: fix gotls load failed

* fix: crash issue and gotls load failed issue
  • Loading branch information
hengyoush authored Jan 3, 2025
1 parent 6d0b142 commit cb48df0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion agent/protocol/mysql/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func ProcessBinaryResultsetRowPacket(packet *MysqlPacket, columnDefs []ColDefini
common.ProtocolParserLog.Warningln("Not enough bytes.")
}

nullBitmap := packet.msg[kBinaryResultsetRowHeaderOffset:nullBitmapLen]
nullBitmap := packet.msg[kBinaryResultsetRowHeaderOffset : kBinaryResultsetRowHeaderOffset+nullBitmapLen]

for i := 0; i < len(columnDefs); i++ {
null_bitmap_bytepos := (i + kBinaryResultsetRowNullBitmapOffset) / 8
Expand Down
7 changes: 3 additions & 4 deletions bpf/gotls.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@ static __inline void assign_arg(void* arg, size_t arg_size, struct location_t lo
if (loc.type == kLocationTypeStack) {
bpf_probe_read(arg, arg_size, sp + loc.offset);
} else if (loc.type == kLocationTypeRegisters) {
if (loc.offset >= 0) {
if (loc.offset <= (1<<10)) {
bpf_probe_read(arg, arg_size, (char*)regs + loc.offset);
}
if (loc.offset < 0 || loc.offset > 1000) {
return;
}
bpf_probe_read(arg, arg_size, (char*)regs + loc.offset);
}
}

Expand Down

0 comments on commit cb48df0

Please sign in to comment.