code wiki / _hdl_build / nx_recycler_bounds.nx

nx_recycler_bounds.nx

buildroot/runtime/_hdl_build/nx_recycler_bounds.nx

1626 B22 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic recycler
docsdependenciesstructsconstsfunctions

about

nx_recycler_bounds.nx -- a hardening primitive RECYCLED FROM Heartbleed (CVE-2014-0160; the real intake artifact is knowledge/fetched/recyc_heartbleed.raw). Heartbleed's root: OpenSSL copied a CALLER-CLAIMED payload length into the response without clamping it to the bytes actually received -> it read ~64KB of adjacent process memory past the real record. The fix-by-construction (what they lacked): NEVER trust a claimed length -- clamp to min(claimed, available, capacity). This is the reusable bounds primitive the Nishi Recycler extracted from their garbage; every sovereign parser (TLS/HTTP/X509) should move untrusted length-prefixed bytes through it. ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_recycler_bounds.nx nx_recycler_bounds_gate.nx

imports: nx_syscalls.nx

imported by: nx_recycler_bounds_gate.nx

structs

none

consts

none

functions

11func rb_bounded_copy(dst: *u8, dstcap: i64, src: *u8, srclen: i64, claimed: i64) -> i64
called by 1: main
22func rb_is_overclaim(srclen: i64, claimed: i64) -> i64 { if claimed > srclen { return 1 } return 0 }
called by 1: main