Update util.go

This commit is contained in:
0xcharry 2026-02-09 15:25:30 +01:00 committed by GitHub
parent c12959dc8c
commit 8a5663ce4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -69,6 +69,12 @@ func MemoryPtr(m []byte, offset, size int64) []byte {
return nil
}
if offset < 0 || size < 0 {
return nil
}
if offset+size > int64(len(m)) {
return nil
}
if len(m) > int(offset) {
return m[offset : offset+size]
}