1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

agent: fix two bugs.

* agent/command.c (cmd_keytocard): Decrement KEYDATALEN.
* agent/findkey.c (agent_public_key_from_file): Increment for ELEMS.

--
For ECDSA and ECDH, there are 6 elements.
This commit is contained in:
NIIBE Yutaka 2013-02-22 12:55:11 +09:00
parent 7d376ffa32
commit 3c3648e720
2 changed files with 2 additions and 1 deletions

View File

@ -2197,6 +2197,7 @@ cmd_keytocard (assuan_context_t ctx, char *line)
gcry_sexp_sprint (s_skey, GCRYSEXP_FMT_CANON, keydata, keydatalen); gcry_sexp_sprint (s_skey, GCRYSEXP_FMT_CANON, keydata, keydatalen);
gcry_sexp_release (s_skey); gcry_sexp_release (s_skey);
keydatalen--; /* Decrement for last '\0'. */
/* Add timestamp "created-at" in the private key */ /* Add timestamp "created-at" in the private key */
timestamp = isotime2epoch (timestamp_str); timestamp = isotime2epoch (timestamp_str);
snprintf (keydata+keydatalen-1, 30, "(10:created-at10:%010lu))", timestamp); snprintf (keydata+keydatalen-1, 30, "(10:created-at10:%010lu))", timestamp);

View File

@ -828,7 +828,7 @@ agent_public_key_from_file (ctrl_t ctrl,
int i, idx; int i, idx;
gcry_sexp_t s_skey; gcry_sexp_t s_skey;
char algoname[6]; char algoname[6];
char elems[6]; char elems[7];
gcry_sexp_t uri_sexp, comment_sexp; gcry_sexp_t uri_sexp, comment_sexp;
const char *uri, *comment; const char *uri, *comment;
size_t uri_length, comment_length; size_t uri_length, comment_length;