From 68c04d3d540722a7fc54d17d6c6571d77d6ff108 Mon Sep 17 00:00:00 2001 From: corvid Date: Thu, 29 Sep 2011 15:59:46 +0000 Subject: password shredding Justus had written a patch for this, but the list archive didn't want to disgorge it, so I wrote one. --- dlib/dlib.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'dlib/dlib.c') diff --git a/dlib/dlib.c b/dlib/dlib.c index f2ef2dd1..a3c59060 100644 --- a/dlib/dlib.c +++ b/dlib/dlib.c @@ -133,6 +133,15 @@ char *dStrstrip(char *s) return s; } +/* + * Clear the contents of the string + */ +void dStrshred(char *s) +{ + if (s) + memset(s, 0, strlen(s)); +} + /* * Return a new string of length 'len' filled with 'c' characters */ @@ -335,6 +344,15 @@ void dStr_truncate (Dstr *ds, int len) } } +/* + * Clear a Dstr. + */ +void dStr_shred (Dstr *ds) +{ + if (ds && ds->sz > 0) + memset(ds->str, '\0', ds->sz); +} + /* * Erase a substring. */ -- cgit v1.2.3