aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/secure/memcpy_chk.c
Commit message (Collapse)AuthorAgeFilesLines
* include: de-macro __ssp_overlap(), improve semantics and checkingKyle Evans2024-07-131-1/+1
| | | | | | | | | | | | | | | 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
* libc: move __ssp_overlap back out into <ssp/ssp.h>Kyle Evans2024-07-131-2/+0
| | | | | | | | | | | | We'll be using it in some upcoming definitions in headers, so move it back now but slap a warning on it. Our upcoming uses will all be inside of inline functions, so we're not overly concerned about double evaluation immediately. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45677
* Import _FORTIFY_SOURCE implementation from NetBSDKyle Evans2024-05-131-0/+53
This is a mostly-unmodified copy of the various *_chk implementations and headers from NetBSD, without yet modifying system headers to start actually including them. A future commit will also apply the needed bits to fix ssp/unistd.h. Reviewed by: imp, pauamma_gundo.com (both previous versions), kib Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32306