Changeset 12017
cacheex-aio: validate camd35/cccam wire bounds and fix feature trigger overflows
Harden CS_CACHEEX_AIO camd35 and CCcam packet parsers and serializers
against remote buffer overflows, out-of-bounds reads, and sender crashes:
- Pass actual received packet length into camd35_cacheex_feature_trigger_in(),
cc_cacheex_feature_trigger_in(), camd35_cacheex_push_in(), and
cc_cacheex_push_in(), rejecting truncated or malformed packets before
modifying peer filter tables or allocating node lists.
- Validate nprids <= CS_MAXPROV and full entry bounds in Feature 64
(lg_only_tab) receivers to prevent remote stack buffer overflow.
- Clamp Feature 32 (aio_version) strnlen() length to available packet bytes.
- Validate node list byte count and maxhop/maxhop_lg before allocating
csp_lastnodes in push_in handlers, and check for the trailing LG flag byte
only when present in the packet (preventing heap OOB reads and stale-buffer
localgenerated spoofing from non-AIO peers).
- Fix Feature 64 sender uint8_t loop wrap/stack smash (>= 256 hex chars),
use exact binary length (bin_len + 1) checked against payload capacity,
and return NULL on OOM in cxaio_ftab_to_buf() (avoiding free("") crash).
- Account for the 4-byte feature header in Feature 2/4/8 sender bounds checks
(fixing off-by-4 stack overflows), guard cl->reader/cl->account NULL
pointers, remove dead VLA copy in cc_cacheex_feature_trigger(), and advance
offset i even when d->caid == 0 in Feature 4.
thanks tem_invictus






Reply With Quote