Skip to content

buffer: add optional -fbounds-safety annotations for struct buffer - #1105

Open
LaptopsPlural wants to merge 3 commits into
OpenVPN:masterfrom
LaptopsPlural:local/buffer-fbounds-safety
Open

LaptopsPlural wants to merge 3 commits into
OpenVPN:masterfrom
LaptopsPlural:local/buffer-fbounds-safety

Conversation

@LaptopsPlural

@LaptopsPlural LaptopsPlural commented Sep 11, 2026

Copy link
Copy Markdown

Summary

Secure-by-design memory-safety hardening. Annotates struct buffer.data with optional Clang -fbounds-safety / sized-by macros tied to capacity. Default builds unchanged (ENABLE_FBOUNDS_SAFETY OFF).

Per CONTRIBUTING: GitHub PRs are for discussion; will also send git format-patch to openvpn-devel / Gerrit for merge.

Contributor: Jeff Bindel via LaptopsPlural. Not a vulnerability PoC.

Test plan

  • Default configure/make
  • Optional bounds-safety ON with supporting Clang

Introduce inert OVPN_SIZED_BY*_ macros (OFF by default) and annotate the
struct buffer data/capacity pair used on packet paths. Capacity-first
assign already present in alloc paths (documented). Default builds
unchanged; ENABLE_FBOUNDS_SAFETY / --enable-fbounds-safety opt-in for
experimental Clang toolchains.

Signed-off-by: Jeff <jeff@incrediblybased.co>
Align trailing comments and preprocessor macros with project
.clang-format so the style CI check passes.

Signed-off-by: Jeff <jeff@incrediblybased.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant