* Add a warning in case the length of the string isn't the length of
authorColin Leroy <colin@colino.net>
Mon, 17 Nov 2014 14:13:12 +0000 (15:13 +0100)
committerColin Leroy <colin@colino.net>
Mon, 17 Nov 2014 14:13:12 +0000 (15:13 +0100)
the decoded base64 content.
* Base64-encoded crypt results of the passwords can contain \0, so
treat them as binary.

src/common/utils.c
src/prefs_gtk.c

index 9c3d940..f322ac8 100644 (file)
@@ -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;
 }
 
index a4a14e2..897c9cf 100644 (file)
@@ -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) =