HomeFreeBSD

include: de-macro __ssp_overlap(), improve semantics and checking

Description

include: de-macro __ssp_overlap(), improve semantics and checking

Switch away from pointer arithmetic to provide more obvious semantics
for checking overlap on pointer ranges. This lets us remove some casts
that need not exist and removes some possible fragility in its use.

While we're here, check for overflow just in case; sometimes we use a
caller-supplied size if __builtin_object_size(3) can't deduce the buffer
size, and we should fail the check if the size is nonsensical for the
provided buffers.

Reviewed by: markj
Sponsored by: Klara, Inc.
Sponsored by: Stormshield

Details

Provenance
kevansAuthored on Jul 13 2024, 5:16 AM
Parents
rG020d003c8636: libc: tests: add testing infrastructure for _FORTIFY_SOURCE
Branches
Unknown
Tags
Unknown