[git] GnuPG - branch, master, updated. gnupg-2.1.0-57-gfabcf14

by Werner Koch cvs at cvs.gnupg.org
Tue Dec 2 14:13:18 CET 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  fabcf1440a6900b9471f11e4f2a015e9f2d1a74c (commit)
      from  0367a4b8cfbf1f197e093ca2b83b27e0a409c3c7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit fabcf1440a6900b9471f11e4f2a015e9f2d1a74c
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Dec 2 14:13:53 2014 +0100

    agent: Replace some sprintf.
    
    * agent/call-scd.c (agent_card_pksign): Replace sprintf by bin2hex.
    * agent/command-ssh.c (ssh_identity_register): Ditto.
    * agent/pkdecrypt.c (agent_pkdecrypt): Replace sprintf by
    put_membuf_printf.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/agent/call-scd.c b/agent/call-scd.c
index 289b2d9..ade7ef1 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -822,8 +822,8 @@ agent_card_pksign (ctrl_t ctrl,
                    const unsigned char *indata, size_t indatalen,
                    unsigned char **r_buf, size_t *r_buflen)
 {
-  int rc, i;
-  char *p, line[ASSUAN_LINELENGTH];
+  int rc;
+  char line[ASSUAN_LINELENGTH];
   membuf_t data;
   struct inq_needpin_s inqparm;
 
@@ -835,10 +835,8 @@ agent_card_pksign (ctrl_t ctrl,
   if (indatalen*2 + 50 > DIM(line))
     return unlock_scd (ctrl, gpg_error (GPG_ERR_GENERAL));
 
-  sprintf (line, "SETDATA ");
-  p = line + strlen (line);
-  for (i=0; i < indatalen ; i++, p += 2 )
-    sprintf (p, "%02X", indata[i]);
+  bin2hex (indata, indatalen, stpcpy (line, "SETDATA "));
+
   rc = assuan_transact (ctrl->scd_local->ctx, line,
                         NULL, NULL, NULL, NULL, NULL, NULL);
   if (rc)
diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index 493011c..2d00512 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -3063,7 +3063,6 @@ ssh_identity_register (ctrl_t ctrl, ssh_key_type_spec_t *spec,
   char *comment = NULL;
   char *key_fpr = NULL;
   const char *initial_errtext = NULL;
-  unsigned int i;
   struct pin_entry_info_s *pi = NULL, *pi2;
 
   err = ssh_key_grip (key, key_grip_raw);
@@ -3139,9 +3138,7 @@ ssh_identity_register (ctrl_t ctrl, ssh_key_type_spec_t *spec,
     goto out;
 
   /* Cache this passphrase. */
-  for (i = 0; i < 20; i++)
-    sprintf (key_grip + 2 * i, "%02X", key_grip_raw[i]);
-
+  bin2hex (key_grip_raw, 20, key_grip);
   err = agent_put_cache (key_grip, CACHE_MODE_SSH, pi->pin, ttl);
   if (err)
     goto out;
diff --git a/agent/pkdecrypt.c b/agent/pkdecrypt.c
index 945de3c..8c09b8c 100644
--- a/agent/pkdecrypt.c
+++ b/agent/pkdecrypt.c
@@ -94,14 +94,9 @@ agent_pkdecrypt (ctrl_t ctrl, const char *desc_text,
           goto leave;
         }
 
-      {
-        char tmpbuf[60];
-
-        sprintf (tmpbuf, "(5:value%u:", (unsigned int)len);
-        put_membuf (outbuf, tmpbuf, strlen (tmpbuf));
-        put_membuf (outbuf, buf, len);
-        put_membuf (outbuf, ")", 2);
-      }
+      put_membuf_printf (outbuf, "(5:value%u:", (unsigned int)len);
+      put_membuf (outbuf, buf, len);
+      put_membuf (outbuf, ")", 2);
     }
   else
     { /* No smartcard, but a private key */

-----------------------------------------------------------------------

Summary of changes:
 agent/call-scd.c    |   10 ++++------
 agent/command-ssh.c |    5 +----
 agent/pkdecrypt.c   |   11 +++--------
 3 files changed, 8 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list