summaryrefslogtreecommitdiff
path: root/libguile/gc-malloc.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-12-04 19:31:20 +0100
committerAndy Wingo <wingo@pobox.com>2010-12-04 19:31:20 +0100
commit3ef6650def28f7c29a2cc983086468d3195167d4 (patch)
tree17d477ff5489b1c29796495e8af32edb01a6ec77 /libguile/gc-malloc.c
parent8556760c234b75e1faba956ba7b3b44175783459 (diff)
downloadguile-3ef6650def28f7c29a2cc983086468d3195167d4.tar.gz
make-string et al nulls memory if not given an initializer
* libguile/gc-malloc.c: Add a note that the gc-malloc does not clear the memory block, so users need to make sure it is initialized. * libguile/bitvectors.c (scm_c_make_bitvector): * libguile/bytevectors.c (scm_make_bytevector): * libguile/strings.c (scm_c_make_string): If no initializer is given, initialize the bytes to 0. Prevents information leakage if an app uses make-string et al without initializers. * libguile/foreign.c (make_cif): Initialize this too, to prevent leakage in the struct holes. Paranoia...
Diffstat (limited to 'libguile/gc-malloc.c')
-rw-r--r--libguile/gc-malloc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c
index e409b6eb2..4f77f65dd 100644
--- a/libguile/gc-malloc.c
+++ b/libguile/gc-malloc.c
@@ -169,8 +169,10 @@ scm_gc_unregister_collectable_memory (void *mem, size_t size, const char *what)
#endif
}
-/* Allocate SIZE bytes of memory whose contents should not be scanned for
- pointers (useful, e.g., for strings). */
+/* Allocate SIZE bytes of memory whose contents should not be scanned
+ for pointers (useful, e.g., for strings). Note though that this
+ memory is *not* cleared; be sure to initialize it to prevent
+ information leaks. */
void *
scm_gc_malloc_pointerless (size_t size, const char *what)
{