summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heinecke <aheinecke@intevation.de>2014-11-24 10:59:32 +0100
committerMatthias Clasen <mclasen@redhat.com>2014-12-11 09:14:43 -0500
commit7d066258f39fb51f20e57a379b265708c2303d57 (patch)
treea3715ce4eacd9b0e4beaeaa41a9097e630ef4642
parent527d262804017d23540c182da0671023f9c8ff1b (diff)
downloadgtk+-7d066258f39fb51f20e57a379b265708c2303d57.tar.gz
Remove overzealous validity check for secrets
We directly get the length of the secret from the g_variant and use it in a following g_strndup which ensures that the resulting string is terminated. This fixes reading secrets which were stored by system-config-printer. https://bugzilla.gnome.org/show_bug.cgi?id=740612
-rw-r--r--modules/printbackends/cups/gtkcupssecretsutils.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/printbackends/cups/gtkcupssecretsutils.c b/modules/printbackends/cups/gtkcupssecretsutils.c
index 895e4bbcdb..7c5f374491 100644
--- a/modules/printbackends/cups/gtkcupssecretsutils.c
+++ b/modules/printbackends/cups/gtkcupssecretsutils.c
@@ -200,10 +200,9 @@ get_secret_cb (GObject *source_object,
g_variant_unref (secret);
- if (ba_passwd == NULL || strlen (ba_passwd) > len + 1)
+ if (ba_passwd == NULL)
{
- /* No secret or the secret is not a zero terminated value */
- GTK_NOTE (PRINTING, g_print ("Invalid secret.\n"));
+ GTK_NOTE (PRINTING, g_print ("Invalid / no secret found.\n"));
g_variant_unref (s_value);
goto fail;
}