[PATCH] use g_debug(format, ...) safely

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Jun 2 04:52:23 CEST 2015


* pinentry/password-cache.c (password_cache_clear): use g_debug safely
  in case error->message is malformed.

--

Without this change, with -Werror=format-security, we see:

password-cache.c: In function ‘password_cache_clear’:
password-cache.c:153:7: error: format not a string literal and no format arguments [-Werror=format-security]
       g_debug(error->message);
       ^
---
 pinentry/password-cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pinentry/password-cache.c b/pinentry/password-cache.c
index 60a9c3a..70b33f4 100644
--- a/pinentry/password-cache.c
+++ b/pinentry/password-cache.c
@@ -150,7 +150,7 @@ password_cache_clear (const char *keygrip)
     {
       printf("Failed to clear password for key %s with secret service: %s\n",
 	     keygrip, error->message);
-      g_debug(error->message);
+      g_debug("%s", error->message);
       g_error_free (error);
       return -1;
     }
-- 
2.1.4




More information about the Gnupg-devel mailing list