From 3ef6650def28f7c29a2cc983086468d3195167d4 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 4 Dec 2010 19:31:20 +0100 Subject: 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... --- libguile/bytevectors.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libguile/bytevectors.c') diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c index 31703bf2e..30adbff57 100644 --- a/libguile/bytevectors.c +++ b/libguile/bytevectors.c @@ -482,6 +482,8 @@ SCM_DEFINE (scm_make_bytevector, "make-bytevector", 1, 1, 0, for (i = 0; i < c_len; i++) contents[i] = c_fill; } + else + memset (SCM_BYTEVECTOR_CONTENTS (bv), 0, c_len); return bv; } -- cgit v1.2.3