Latent heap overflow in sbuf_extend via int truncation of caller length (zero callers, unreachable today)
Summary
sbuf_extend (subr_sbuf.c:151) takes int addlen, computes newsize=sbuf_extendsize(s_size+addlen) (:158) then memcpy(newbuf,s_buf,s_size) (:162) WITHOUT verifying newsize>=s_size. sbuf_extendsize (:131) returns 16 for arg<=16 INCLUDING negative. sbuf_bcopyin (:424) calls sbuf_extend(s,len-SBUF_FREESPACE(s)) where len is size_t; len>=2^31+freespace -> size_t diff bit31 set truncates to negative int addlen -> s_size+addlen negative -> sbuf_extendsize returns 16 -> if s_size>16 memcpy writes s_size bytes into 16-byte buffer = heap overflow. ALSO sbuf_uionew (:246) uio_resid+1 overflow. UNREACHABLE: sbuf_bcopyin/sbuf_copyin/sbuf_uionew have ZERO callers in sys/ (ripgrep). All live consumers append via sbuf_put_byte addlen==1. Latent API foot-gun for future module callers.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0082 Β· 1 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | Latent heap overflow in sbuf_extend via int truncation of caller length (zero ca | 275 B | view raw |
Fix verification
fixedfix.diff applied + combined nativekernel build rc=0 (-Werror)
fix.diff applied + combined nativekernel build rc=0 (-Werror)
Confirmed kernel references
β
Detail
Exploit chain
none (Info severity)
Evidence (decisive lines)
Source-confirmed at sys/kern/subr_sbuf.c:150: latent heap overflow via int truncation (zero callers, unreachable)
Verified recommended fix
Source-confirmed at sys/kern/subr_sbuf.c:150: latent heap overflow via int truncation (zero callers, unreachable)
Verdict
Source-confirmed at sys/kern/subr_sbuf.c:150: latent heap overflow via int truncation (zero callers, unreachable)
No comments yet.