diff options
author | Werner Koch <wk@gnupg.org> | 2020-03-30 17:27:42 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2020-03-30 17:27:42 +0200 |
commit | c5c21a064671dc8e461434d19cbde67b89df25e2 (patch) | |
tree | 6944d31b253580e05cd6b31652871e91f66fa3cc | |
parent | sm: Fix possible NULL deref in error messages of --gen-key. (diff) | |
download | gnupg2-c5c21a064671dc8e461434d19cbde67b89df25e2.tar.xz gnupg2-c5c21a064671dc8e461434d19cbde67b89df25e2.zip |
agent: Print an error if gpg-protect reads the extended key format.
* agent/protect-tool.c (read_key): Detect simple extended key format.
--
This is a quick hack to get a useful error messages. The real fix is
to replace the protect tool by a more useful new tool.
Signed-off-by: Werner Koch <wk@gnupg.org>
-rw-r--r-- | agent/protect-tool.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/agent/protect-tool.c b/agent/protect-tool.c index 31256695e..bcbe4588d 100644 --- a/agent/protect-tool.c +++ b/agent/protect-tool.c @@ -318,6 +318,11 @@ read_key (const char *fname) buf = read_file (fname, &buflen); if (!buf) return NULL; + if (buflen >= 4 && !memcmp (buf, "Key:", 4)) + { + log_error ("Extended key format is not supported by this tool\n"); + return NULL; + } key = make_canonical (fname, buf, buflen); xfree (buf); return key; |