[prev in list] [next in list] [prev in thread] [next in thread]
List: gnupg-devel
Subject: [PATCH] agent: fix two bugs
From: NIIBE Yutaka <gniibe () fsij ! org>
Date: 2013-02-22 4:03:10
Message-ID: 87obfdhu69.fsf () cfw2 ! gniibe ! org
[Download RAW message or body]
This is a fix which I found during ECC card/token support.
(1) The length of keydata should not include trailing '\0'.
(2) Since ECDSA and ECDH has six elements, we need to allocate 7 (+1 for
trailing '\0').
I'll apply and push these changes to master.
diff --git a/agent/command.c b/agent/command.c
index 2844398..823b233 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -2197,6 +2197,7 @@ cmd_keytocard (assuan_context_t ctx, char *line)
gcry_sexp_sprint (s_skey, GCRYSEXP_FMT_CANON, keydata, keydatalen);
gcry_sexp_release (s_skey);
+ keydatalen--; /* Decrement for last '\0'. */
/* Add timestamp "created-at" in the private key */
timestamp = isotime2epoch (timestamp_str);
snprintf (keydata+keydatalen-1, 30, "(10:created-at10:%010lu))", timestamp);
diff --git a/agent/findkey.c b/agent/findkey.c
index b17870e..ebdcc03 100644
--- a/agent/findkey.c
+++ b/agent/findkey.c
@@ -828,7 +828,7 @@ agent_public_key_from_file (ctrl_t ctrl,
int i, idx;
gcry_sexp_t s_skey;
char algoname[6];
- char elems[6];
+ char elems[7];
gcry_sexp_t uri_sexp, comment_sexp;
const char *uri, *comment;
size_t uri_length, comment_length;
--
_______________________________________________
Gnupg-devel mailing list
Gnupg-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic