From b3c7219249599faea3350f76a37a399c58e04667 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 16 Oct 2015 03:14:09 +0200 Subject: limitations on allocsize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- include/slibc-alloc.h | 5 +++++ src/slibc-alloc.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/include/slibc-alloc.h b/include/slibc-alloc.h index d792ebc..edc7cc7 100644 --- a/include/slibc-alloc.h +++ b/include/slibc-alloc.h @@ -47,6 +47,11 @@ void secure_free(void*); * This function returns the allocation size of * a memory segment. * + * Note, this only works for the malloc-family of functions. + * It does not work on `alloca`, `strdupa` (or similar + * functions), memory maps (that are not created by `malloc`,) + * or arrays. + * * `p = malloc(n), allocsize(p)` will return `n`. * * @param segment The memory segment. diff --git a/src/slibc-alloc.c b/src/slibc-alloc.c index ce271b5..743597e 100644 --- a/src/slibc-alloc.c +++ b/src/slibc-alloc.c @@ -62,6 +62,11 @@ void secure_free(void* segment) * This function returns the allocation size of * a memory segment. * + * Note, this only works for the malloc-family of functions. + * It does not work on `alloca`, `strdupa` (or similar + * functions), memory maps (that are not created by `malloc`,) + * or arrays. + * * `p = malloc(n), allocsize(p)` will return `n`. * * @param segment The memory segment. -- cgit v1.2.3-70-g09d2