commit 278a5b047584d153cab765bacdf73cbcb795d4a0
parent 07b572bc66dd5016e99e3e729055e8b8cdfa72cf
Author: Colin Leroy <colin@colino.net>
Date: Mon, 17 Nov 2014 15:13:12 +0100
* Add a warning in case the length of the string isn't the length of
the decoded base64 content.
* Base64-encoded crypt results of the passwords can contain \0, so
treat them as binary.
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/common/utils.c b/src/common/utils.c
@@ -5558,6 +5558,10 @@ guchar *g_base64_decode_zero(const gchar *text, gsize *out_len)
g_free(tmp);
+ if (strlen(out) != *out_len) {
+ g_warning ("strlen(out) %d != *out_len %d", strlen(out), *out_len);
+ }
+
return out;
}
diff --git a/src/prefs_gtk.c b/src/prefs_gtk.c
@@ -222,7 +222,7 @@ static void prefs_config_parse_one_line(PrefParam *param, const gchar *buf)
gchar *tmp;
gsize len;
- tmp = g_base64_decode_zero(&value[1], &len);
+ tmp = g_base64_decode(&value[1], &len);
passcrypt_decrypt(tmp, len);
*((gchar **)param[i].data) =