Implement allocation buffers for internal use

System Internals / glibc - Florian Weimer [redhat.com] - 21 June 2017 16:43 EDT

This commit adds fixed-size allocation buffers. The primary use case is in NSS modules, where dynamically sized data is stored in a fixed-size buffer provided by the caller.

Other uses include a replacement of mempcpy cascades (which is safer due to the size checking inherent to allocation buffers).

4dd8e7c Implement allocation buffers for internal use
ChangeLog | 17 +
include/alloc_buffer.h | 367 +++++++++++++++++++
malloc/Makefile | 6 +
malloc/Versions | 8 +-
malloc/alloc_buffer_alloc_array.c | 47 +++
malloc/alloc_buffer_allocate.c | 36 ++
malloc/alloc_buffer_copy_bytes.c | 34 ++
malloc/alloc_buffer_copy_string.c | 30 ++
malloc/alloc_buffer_create_failure.c | 31 ++
malloc/tst-alloc_buffer.c | 665 +++++++++++++++++++++++++++++++++++
10 files changed, 1240 insertions(+), 1 deletion(-)

Upstream: sourceware.org


  • Share