From 62c87a837463fdf09d9e7d1a605000c21f8da060 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Wed, 4 Apr 2018 13:01:37 +0200 Subject: Implement the wrapper function cleanse_buffer in masterpassword.c --- libsylph/masterpassword.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libsylph/masterpassword.c') diff --git a/libsylph/masterpassword.c b/libsylph/masterpassword.c index b86f06b..2da6969 100644 --- a/libsylph/masterpassword.c +++ b/libsylph/masterpassword.c @@ -38,11 +38,17 @@ gchar *get_master_password(void) { return master_password; } -void unload_master_password(void) { - +void cleanse_buffer(void *buf, size_t len) { #if USE_SSL - OPENSSL_cleanse(master_password, strlen(master_password)); + OPENSSL_cleanse(buf, len); +#else + memset(buf, 0, len); /* better than nothing */ #endif +} + +void unload_master_password(void) { + + cleanse_buffer(master_password, strlen(master_password)); g_free(master_password); master_password = NULL; -- cgit v1.3