Skip to content

Commit

Permalink
fix : out of silice range.
Browse files Browse the repository at this point in the history
Signed-off-by: cfc4n <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n committed Sep 27, 2023
1 parent 5bfc790 commit 9dcd07a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
4 changes: 0 additions & 4 deletions user/module/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ const (
MasterKeyHookFuncBoringSSL = "SSL_in_init"
)

// buffer size times of ebpf perf map
// buffer size = BufferSizeOfEbpfMap * os.pagesize
const BufferSizeOfEbpfMap = 1024 * 10

const (
MasterSecretKeyLogName = "ecapture_masterkey.log"
)
8 changes: 8 additions & 0 deletions user/module/const_androidgki.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build androidgki
// +build androidgki

package module

// buffer size times of ebpf perf map
// buffer size = BufferSizeOfEbpfMap * os.pagesize
const BufferSizeOfEbpfMap = 1024
8 changes: 8 additions & 0 deletions user/module/const_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build !androidgki
// +build !androidgki

package module

// buffer size times of ebpf perf map
// buffer size = BufferSizeOfEbpfMap * os.pagesize
const BufferSizeOfEbpfMap = 1024 * 10
7 changes: 7 additions & 0 deletions user/module/probe_openssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,10 @@ func (m *MOpenSSLProbe) saveMasterSecretBSSL(secretEvent *event.MasterSecretBSSL
default:
var length int
length = int(secretEvent.HashLen)
if length > event.EvpMaxMdSize {
m.logger.Println("master secret length is too long, truncate to 64 bytes, but it may cause keylog file error")
length = event.EvpMaxMdSize
}
// 判断 密钥是否为空
if m.bSSLEvent13NullSecrets(secretEvent) {
return
Expand Down Expand Up @@ -647,6 +651,9 @@ func (m *MOpenSSLProbe) bSSLEvent12NullSecrets(e *event.MasterSecretBSSLEvent) b
var isNull = true
var hashLen = int(e.HashLen)
for i := 0; i < hashLen; i++ {
if hashLen >= len(e.Secret) {
break
}
if e.Secret[i] != 0 {
isNull = false
break
Expand Down

0 comments on commit 9dcd07a

Please sign in to comment.