From: Mikael Djurfeldt <djurfeldt@nada.kth.se>
Cc: Greg Troxel <gdt@ir.bbn.com>
Subject: Re: make-string uninitialized memory eposure considered harmful
Date: Sat, 11 Jan 2003 12:41:44 +0100 [thread overview]
Message-ID: <xy7y95rsykn.fsf@nada.kth.se> (raw)
In-Reply-To: <Pine.LNX.4.30.0301101644310.15574-100000@urd.norna.redhog.org> (Egil Moeller's message of "Fri, 10 Jan 2003 16:51:33 +0100 (CET)")
Egil Moeller <redhog@redhog.org> writes:
> one might think of a situation when one would like to be able to
> create a string (or other object?) that, when garbage-collected, was
> guaranteed to be overwritten with 0's. Is this doable?
(define-module (utils self-destruct)
#:export (make-self-destructing-string))
(define guard-string (make-guardian))
(define (make-self-destructing-string k)
(let ((s (make-string k)))
(guard-string s)
s))
(define (destroy-strings)
(cond ((guard-string)
=>
(lambda (s)
(string-fill! s #\nul)
(destroy-strings)))))
(add-hook! after-gc-hook destroy-strings)
M
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2003-01-11 11:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-10 19:54 make-string uninitialized memory eposure considered harmful Greg Troxel
2003-01-10 15:51 ` Egil Moeller
2003-01-11 11:41 ` Mikael Djurfeldt [this message]
2003-01-12 17:45 ` Marius Vollmer
2003-01-10 20:56 ` Thien-Thi Nguyen
2003-01-11 6:52 ` tomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xy7y95rsykn.fsf@nada.kth.se \
--to=djurfeldt@nada.kth.se \
--cc=gdt@ir.bbn.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).