From 7f2064ed526db2e54b3ebde04e58beaffbb397ed Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Sun, 15 Apr 2018 21:58:06 +0200 Subject: Finish master password unload issue. Fix an old bug reintroduced by the magic of copy & paste --- libsylph/masterpassword.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libsylph') diff --git a/libsylph/masterpassword.c b/libsylph/masterpassword.c index bac49c4..3d7af94 100644 --- a/libsylph/masterpassword.c +++ b/libsylph/masterpassword.c @@ -50,6 +50,7 @@ void cleanse_buffer(void *buf, size_t len) { void unload_master_password(void) { + debug_print("Unloading master password\n"); if (master_password == NULL) { /* not loaded / already unloaded */ return; @@ -57,6 +58,7 @@ void unload_master_password(void) { cleanse_buffer(master_password, strlen(master_password)); g_free(master_password); master_password = NULL; + debug_print("Master password unloaded\n"); } @@ -105,7 +107,7 @@ gchar *decrypt_with_master_password(const gchar *str) { if (decrypt_data(&new_str, str + str_prefix, master_password, - strlen(str) - str_prefix) != MP_RC_OK) { + strlen(str) + 1 - str_prefix) != MP_RC_OK) { OPENSSL_cleanse(new_str, strlen(new_str)); g_free(new_str); return g_strdup(str); @@ -136,7 +138,7 @@ gchar *encrypt_with_master_password(const gchar *str) { &length_encrypted, str, master_password, - strlen(str), + strlen(str) + 1, prefs_common.encrypted_password_min_length, TRUE) != MP_RC_OK) { g_free(new_str); -- cgit v1.3