|
|
1f20c2 |
diff -up gnupg-2.2.21/common/server-help.c.coverity gnupg-2.2.21/common/server-help.c
|
|
|
1f20c2 |
--- gnupg-2.2.21/common/server-help.c.coverity 2019-02-11 10:59:34.000000000 +0100
|
|
|
1f20c2 |
+++ gnupg-2.2.21/common/server-help.c 2020-07-20 17:09:57.416148768 +0200
|
|
|
1f20c2 |
@@ -156,7 +156,7 @@ get_option_value (char *line, const char
|
|
|
1f20c2 |
*pend = 0;
|
|
|
1f20c2 |
*r_value = xtrystrdup (p);
|
|
|
1f20c2 |
*pend = c;
|
|
|
1f20c2 |
- if (!p)
|
|
|
1f20c2 |
+ if (!*r_value)
|
|
|
1f20c2 |
return my_error_from_syserror ();
|
|
|
1f20c2 |
return 0;
|
|
|
1f20c2 |
}
|
|
|
1f20c2 |
|
|
|
1f20c2 |
|
|
|
1f20c2 |
From 912e77f07d8a42d7ad001eb3df76f6932ccfa857 Mon Sep 17 00:00:00 2001
|
|
|
1f20c2 |
From: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
Date: Wed, 7 Apr 2021 17:37:51 +0200
|
|
|
1f20c2 |
Subject: [PATCH GnuPG 01/19] agent: Avoid memory leaks
|
|
|
1f20c2 |
|
|
|
1f20c2 |
* agent/command.c (cmd_genkey): use goto leave instead of return
|
|
|
1f20c2 |
* agent/cvt-openpgp.c (convert_from_openpgp_main): use goto leave
|
|
|
1f20c2 |
instead of return
|
|
|
1f20c2 |
* agent/genkey.c (agent_ask_new_passphrase): fix typo to free correct
|
|
|
1f20c2 |
pointer
|
|
|
1f20c2 |
(agent_genkey): release memory
|
|
|
1f20c2 |
* agent/gpg-agent.c (check_own_socket): free sockname
|
|
|
1f20c2 |
* agent/protect-tool.c (read_key): free buf
|
|
|
1f20c2 |
(agent_askpin): free passphrase
|
|
|
1f20c2 |
* agent/protect.c (merge_lists): free newlist
|
|
|
1f20c2 |
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
|
|
|
1f20c2 |
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
---
|
|
|
1f20c2 |
agent/command.c | 2 +-
|
|
|
1f20c2 |
agent/cvt-openpgp.c | 5 ++++-
|
|
|
1f20c2 |
agent/genkey.c | 7 +++++--
|
|
|
1f20c2 |
agent/gpg-agent.c | 10 ++++++++--
|
|
|
1f20c2 |
agent/protect-tool.c | 6 +++++-
|
|
|
1f20c2 |
agent/protect.c | 5 ++++-
|
|
|
1f20c2 |
6 files changed, 27 insertions(+), 8 deletions(-)
|
|
|
1f20c2 |
|
|
|
1f20c2 |
diff --git a/agent/protect.c b/agent/protect.c
|
|
|
1f20c2 |
index 76ead444b..50b10eb26 100644
|
|
|
1f20c2 |
--- a/agent/protect.c
|
|
|
1f20c2 |
+++ b/agent/protect.c
|
|
|
1f20c2 |
@@ -949,7 +949,10 @@ merge_lists (const unsigned char *protectedkey,
|
|
|
1f20c2 |
/* Copy the cleartext. */
|
|
|
1f20c2 |
s = cleartext;
|
|
|
1f20c2 |
if (*s != '(' && s[1] != '(')
|
|
|
1f20c2 |
- return gpg_error (GPG_ERR_BUG); /*we already checked this */
|
|
|
1f20c2 |
+ {
|
|
|
1f20c2 |
+ xfree (newlist);
|
|
|
1f20c2 |
+ return gpg_error (GPG_ERR_BUG); /*we already checked this */
|
|
|
1f20c2 |
+ }
|
|
|
1f20c2 |
s += 2;
|
|
|
1f20c2 |
startpos = s;
|
|
|
1f20c2 |
while ( *s == '(' )
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
2.30.2
|
|
|
1f20c2 |
|
|
|
1f20c2 |
|
|
|
1f20c2 |
From 7a707a3eff1c3fbe17a74337776871f408377cee Mon Sep 17 00:00:00 2001
|
|
|
1f20c2 |
From: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
Date: Fri, 9 Apr 2021 16:13:07 +0200
|
|
|
1f20c2 |
Subject: [PATCH GnuPG 03/19] g10: Fix memory leaks
|
|
|
1f20c2 |
|
|
|
1f20c2 |
* g10/card-util.c (change_pin): free answer on errors
|
|
|
1f20c2 |
(ask_card_keyattr): free answer on error
|
|
|
1f20c2 |
* g10/cpr.c (do_get_from_fd): free string
|
|
|
1f20c2 |
* g10/gpg.c (check_permissions): free dir on weird error
|
|
|
1f20c2 |
* g10/import.c (append_new_uid): release knode
|
|
|
1f20c2 |
* g10/keyedit.c (menu_set_keyserver_url): free answer
|
|
|
1f20c2 |
(menu_set_keyserver_url): free user
|
|
|
1f20c2 |
* g10/keygen.c (print_status_key_not_created): move allocation after
|
|
|
1f20c2 |
sanity check
|
|
|
1f20c2 |
(ask_expire_interval): free answer
|
|
|
1f20c2 |
(card_store_key_with_backup): goto leave instaed of return
|
|
|
1f20c2 |
* g10/keyserver.c (parse_keyserver_uri): goto fail instead of return
|
|
|
1f20c2 |
* g10/revoke.c (gen_desig_revoke): release kdbhd
|
|
|
1f20c2 |
(gen_desig_revoke): free answer
|
|
|
1f20c2 |
* g10/tofu.c (ask_about_binding): free sqerr and response
|
|
|
1f20c2 |
* g10/trustdb.c (ask_ownertrust): free pk
|
|
|
1f20c2 |
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
|
|
|
1f20c2 |
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
---
|
|
|
1f20c2 |
g10/card-util.c | 14 +++++++++++---
|
|
|
1f20c2 |
g10/cpr.c | 6 +++++-
|
|
|
1f20c2 |
g10/gpg.c | 1 +
|
|
|
1f20c2 |
g10/import.c | 5 ++++-
|
|
|
1f20c2 |
g10/keyedit.c | 8 +++++++-
|
|
|
1f20c2 |
g10/keygen.c | 15 +++++++++++----
|
|
|
1f20c2 |
g10/keyserver.c | 2 +-
|
|
|
1f20c2 |
g10/revoke.c | 6 +++++-
|
|
|
1f20c2 |
g10/tofu.c | 4 ++++
|
|
|
1f20c2 |
g10/trustdb.c | 1 +
|
|
|
1f20c2 |
10 files changed, 50 insertions(+), 12 deletions(-)
|
|
|
1f20c2 |
|
|
|
1f20c2 |
diff --git a/g10/card-util.c b/g10/card-util.c
|
|
|
1f20c2 |
index 36f096f06..c7df8380d 100644
|
|
|
1f20c2 |
--- a/g10/card-util.c
|
|
|
1f20c2 |
+++ b/g10/card-util.c
|
|
|
1f20c2 |
@@ -127,7 +127,7 @@ change_pin (int unblock_v2, int allow_admin)
|
|
|
1f20c2 |
else
|
|
|
1f20c2 |
for (;;)
|
|
|
1f20c2 |
{
|
|
|
1f20c2 |
- char *answer;
|
|
|
1f20c2 |
+ char *answer = NULL;
|
|
|
1f20c2 |
|
|
|
1f20c2 |
tty_printf ("\n");
|
|
|
1f20c2 |
tty_printf ("1 - change PIN\n"
|
|
|
1f20c2 |
diff --git a/g10/tofu.c b/g10/tofu.c
|
|
|
1f20c2 |
index f49083844..83786a08d 100644
|
|
|
1f20c2 |
--- a/g10/tofu.c
|
|
|
1f20c2 |
+++ b/g10/tofu.c
|
|
|
1f20c2 |
@@ -1687,6 +1687,8 @@ ask_about_binding (ctrl_t ctrl,
|
|
|
1f20c2 |
GPGSQL_ARG_END);
|
|
|
1f20c2 |
if (rc)
|
|
|
1f20c2 |
{
|
|
|
1f20c2 |
+ sqlite3_free (sqerr);
|
|
|
1f20c2 |
+ sqerr = NULL;
|
|
|
1f20c2 |
rc = gpg_error (GPG_ERR_GENERAL);
|
|
|
1f20c2 |
break;
|
|
|
1f20c2 |
}
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
2.30.2
|
|
|
1f20c2 |
|
|
|
1f20c2 |
From febbe77870b51e4e1158ae9efeaa0f3aad69a495 Mon Sep 17 00:00:00 2001
|
|
|
1f20c2 |
From: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
Date: Mon, 12 Apr 2021 14:48:59 +0200
|
|
|
1f20c2 |
Subject: [PATCH GnuPG 05/19] tools: Avoid memory leak sfrom gpgspilt
|
|
|
1f20c2 |
|
|
|
1f20c2 |
* tools/gpgsplit.c (write_part): free blob
|
|
|
1f20c2 |
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
|
|
|
1f20c2 |
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
---
|
|
|
1f20c2 |
tools/gpgsplit.c | 1 +
|
|
|
1f20c2 |
1 file changed, 1 insertion(+)
|
|
|
1f20c2 |
|
|
|
1f20c2 |
diff --git a/tools/gpgsplit.c b/tools/gpgsplit.c
|
|
|
1f20c2 |
index cc7bf8ef5..93458068c 100644
|
|
|
1f20c2 |
--- a/tools/gpgsplit.c
|
|
|
1f20c2 |
+++ b/tools/gpgsplit.c
|
|
|
1f20c2 |
@@ -620,6 +620,7 @@ write_part (FILE *fpin, unsigned long pktlen,
|
|
|
1f20c2 |
}
|
|
|
1f20c2 |
}
|
|
|
1f20c2 |
|
|
|
1f20c2 |
+ xfree (blob);
|
|
|
1f20c2 |
goto ready;
|
|
|
1f20c2 |
}
|
|
|
1f20c2 |
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
2.30.2
|
|
|
1f20c2 |
|
|
|
1f20c2 |
|
|
|
1f20c2 |
From 7c8048b686a6e811d0b24febf3c5e2528e7881f1 Mon Sep 17 00:00:00 2001
|
|
|
1f20c2 |
From: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
Date: Tue, 13 Apr 2021 16:23:31 +0200
|
|
|
1f20c2 |
Subject: [PATCH GnuPG 14/19] dirmgr: Avoid memory leaks
|
|
|
1f20c2 |
|
|
|
1f20c2 |
* dirmngr/domaininfo.c (insert_or_update): free di_new
|
|
|
1f20c2 |
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
|
|
|
1f20c2 |
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
---
|
|
|
1f20c2 |
dirmngr/domaininfo.c | 1 +
|
|
|
1f20c2 |
1 file changed, 1 insertion(+)
|
|
|
1f20c2 |
|
|
|
1f20c2 |
diff --git a/dirmngr/domaininfo.c b/dirmngr/domaininfo.c
|
|
|
1f20c2 |
index b41aef366..87782b4b1 100644
|
|
|
1f20c2 |
--- a/dirmngr/domaininfo.c
|
|
|
1f20c2 |
+++ b/dirmngr/domaininfo.c
|
|
|
1f20c2 |
@@ -193,6 +193,7 @@ insert_or_update (const char *domain,
|
|
|
1f20c2 |
log_error ("domaininfo: error allocating helper array: %s\n",
|
|
|
1f20c2 |
gpg_strerror (gpg_err_code_from_syserror ()));
|
|
|
1f20c2 |
drop_extra = bucket;
|
|
|
1f20c2 |
+ xfree (di_new);
|
|
|
1f20c2 |
goto leave;
|
|
|
1f20c2 |
}
|
|
|
1f20c2 |
narray = 0;
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
2.30.2
|
|
|
1f20c2 |
|
|
|
1f20c2 |
|
|
|
1f20c2 |
From ab3b8c53993b3305088efde756a44bac6e6492d4 Mon Sep 17 00:00:00 2001
|
|
|
1f20c2 |
From: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
Date: Tue, 13 Apr 2021 16:34:40 +0200
|
|
|
1f20c2 |
Subject: [PATCH GnuPG 15/19] scd: Avoid memory leaks and uninitialized memory
|
|
|
1f20c2 |
|
|
|
1f20c2 |
* scd/app-piv.c (do_decipher): goto leave, initialize outdatalen
|
|
|
1f20c2 |
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
|
|
|
1f20c2 |
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
---
|
|
|
1f20c2 |
scd/app-piv.c | 4 ++--
|
|
|
1f20c2 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
1f20c2 |
|
|
|
1f20c2 |
diff --git a/scd/app-piv.c b/scd/app-piv.c
|
|
|
1f20c2 |
index 143cc047a..94257f0ee 100644
|
|
|
1f20c2 |
--- a/scd/app-piv.c
|
|
|
1f20c2 |
+++ b/scd/app-piv.c
|
|
|
1f20c2 |
@@ -2483,7 +2483,7 @@ do_decipher (app_t app, ctrl_t ctrl, const char *keyidstr,
|
|
|
1f20c2 |
gpg_error_t err;
|
|
|
1f20c2 |
data_object_t dobj;
|
|
|
1f20c2 |
unsigned char *outdata = NULL;
|
|
|
1f20c2 |
- size_t outdatalen;
|
|
|
1f20c2 |
+ size_t outdatalen = 0;
|
|
|
1f20c2 |
const unsigned char *s;
|
|
|
1f20c2 |
size_t n;
|
|
|
1f20c2 |
int keyref, mechanism;
|
|
|
1f20c2 |
@@ -2582,7 +2582,7 @@ do_decipher (app_t app, ctrl_t ctrl, const char *keyidstr,
|
|
|
1f20c2 |
/* Now verify the Application PIN. */
|
|
|
1f20c2 |
err = verify_chv (app, ctrl, 0x80, 0, pincb, pincb_arg);
|
|
|
1f20c2 |
if (err)
|
|
|
1f20c2 |
- return err;
|
|
|
1f20c2 |
+ goto leave;
|
|
|
1f20c2 |
|
|
|
1f20c2 |
/* Build the Dynamic Authentication Template. */
|
|
|
1f20c2 |
err = concat_tlv_list (0, &apdudata, &apdudatalen,
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
2.30.2
|
|
|
1f20c2 |
|
|
|
1f20c2 |
|
|
|
1f20c2 |
From f182bf91443618323e34261039045a6bde269be5 Mon Sep 17 00:00:00 2001
|
|
|
1f20c2 |
From: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
Date: Tue, 13 Apr 2021 16:44:48 +0200
|
|
|
1f20c2 |
Subject: [PATCH GnuPG 16/19] tools: Avoid memory leaks
|
|
|
1f20c2 |
|
|
|
1f20c2 |
* tools/wks-util.c (wks_cmd_print_wkd_url): Free addrspec on error
|
|
|
1f20c2 |
(wks_cmd_print_wkd_hash): Free addrspec on error
|
|
|
1f20c2 |
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
|
|
|
1f20c2 |
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
---
|
|
|
1f20c2 |
tools/wks-util.c | 14 ++++++++++----
|
|
|
1f20c2 |
1 file changed, 10 insertions(+), 4 deletions(-)
|
|
|
1f20c2 |
|
|
|
1f20c2 |
diff --git a/tools/wks-util.c b/tools/wks-util.c
|
|
|
1f20c2 |
index 516c7fe00..38dd194ff 100644
|
|
|
1f20c2 |
--- a/tools/wks-util.c
|
|
|
1f20c2 |
+++ b/tools/wks-util.c
|
|
|
1f20c2 |
@@ -1192,11 +1192,14 @@ gpg_error_t
|
|
|
1f20c2 |
wks_cmd_print_wkd_hash (const char *userid)
|
|
|
1f20c2 |
{
|
|
|
1f20c2 |
gpg_error_t err;
|
|
|
1f20c2 |
- char *addrspec, *fname;
|
|
|
1f20c2 |
+ char *addrspec = NULL, *fname;
|
|
|
1f20c2 |
|
|
|
1f20c2 |
err = wks_fname_from_userid (userid, 1, &fname, &addrspec);
|
|
|
1f20c2 |
if (err)
|
|
|
1f20c2 |
- return err;
|
|
|
1f20c2 |
+ {
|
|
|
1f20c2 |
+ xfree (addrspec);
|
|
|
1f20c2 |
+ return err;
|
|
|
1f20c2 |
+ }
|
|
|
1f20c2 |
|
|
|
1f20c2 |
es_printf ("%s %s\n", fname, addrspec);
|
|
|
1f20c2 |
|
|
|
1f20c2 |
@@ -1211,12 +1214,15 @@ gpg_error_t
|
|
|
1f20c2 |
wks_cmd_print_wkd_url (const char *userid)
|
|
|
1f20c2 |
{
|
|
|
1f20c2 |
gpg_error_t err;
|
|
|
1f20c2 |
- char *addrspec, *fname;
|
|
|
1f20c2 |
+ char *addrspec = NULL, *fname;
|
|
|
1f20c2 |
char *domain;
|
|
|
1f20c2 |
|
|
|
1f20c2 |
err = wks_fname_from_userid (userid, 1, &fname, &addrspec);
|
|
|
1f20c2 |
if (err)
|
|
|
1f20c2 |
- return err;
|
|
|
1f20c2 |
+ {
|
|
|
1f20c2 |
+ xfree (addrspec);
|
|
|
1f20c2 |
+ return err;
|
|
|
1f20c2 |
+ }
|
|
|
1f20c2 |
|
|
|
1f20c2 |
domain = strchr (addrspec, '@');
|
|
|
1f20c2 |
if (domain)
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
2.30.2
|
|
|
1f20c2 |
|
|
|
1f20c2 |
|
|
|
1f20c2 |
From 600fabd8268c765d45d48873e7a8610e6dae0966 Mon Sep 17 00:00:00 2001
|
|
|
1f20c2 |
From: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
Date: Wed, 14 Apr 2021 15:59:12 +0200
|
|
|
1f20c2 |
Subject: [PATCH GnuPG 17/19] scd: Use the same allocator to free memory
|
|
|
1f20c2 |
|
|
|
1f20c2 |
* scd/command.c (cmd_getinfo): Use free instead of gcry_free to match
|
|
|
1f20c2 |
the original allocator
|
|
|
1f20c2 |
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
|
|
|
1f20c2 |
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
---
|
|
|
1f20c2 |
scd/command.c | 3 ++-
|
|
|
1f20c2 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
1f20c2 |
|
|
|
1f20c2 |
diff --git a/scd/command.c b/scd/command.c
|
|
|
1f20c2 |
index cb0dd379a..9d85c5a41 100644
|
|
|
1f20c2 |
--- a/scd/command.c
|
|
|
1f20c2 |
+++ b/scd/command.c
|
|
|
1f20c2 |
@@ -1832,7 +1832,8 @@ cmd_getinfo (assuan_context_t ctx, char *line)
|
|
|
1f20c2 |
rc = assuan_send_data (ctx, p, strlen (p));
|
|
|
1f20c2 |
else
|
|
|
1f20c2 |
rc = gpg_error (GPG_ERR_NO_DATA);
|
|
|
1f20c2 |
- xfree (p);
|
|
|
1f20c2 |
+ /* allocated by scd/ccid-driver.c which is not using x*alloc/gcry_* */
|
|
|
1f20c2 |
+ free (p);
|
|
|
1f20c2 |
}
|
|
|
1f20c2 |
else if (!strcmp (line, "deny_admin"))
|
|
|
1f20c2 |
rc = opt.allow_admin? gpg_error (GPG_ERR_GENERAL) : 0;
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
2.30.2
|
|
|
1f20c2 |
|
|
|
1f20c2 |
|
|
|
1f20c2 |
From a94b0deab7c2ece2e512f87a52142454354d77b5 Mon Sep 17 00:00:00 2001
|
|
|
1f20c2 |
From: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
Date: Wed, 14 Apr 2021 18:49:03 +0200
|
|
|
1f20c2 |
Subject: [PATCH GnuPG 19/19] g10: Do not allocate memory when we can't return
|
|
|
1f20c2 |
it
|
|
|
1f20c2 |
|
|
|
1f20c2 |
* g10/keyid.c (fpr20_from_pk): Do not allocate memory when we can't
|
|
|
1f20c2 |
return it
|
|
|
1f20c2 |
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
|
|
|
1f20c2 |
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
|
|
1f20c2 |
---
|
|
|
1f20c2 |
g10/keyid.c | 2 +-
|
|
|
1f20c2 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
1f20c2 |
|
|
|
1f20c2 |
diff --git a/g10/keyid.c b/g10/keyid.c
|
|
|
1f20c2 |
index 522cc9cda..f1af2fd90 100644
|
|
|
1f20c2 |
--- a/g10/keyid.c
|
|
|
1f20c2 |
+++ b/g10/keyid.c
|
|
|
1f20c2 |
@@ -899,7 +899,7 @@ fpr20_from_pk (PKT_public_key *pk, byte array[20])
|
|
|
1f20c2 |
compute_fingerprint (pk);
|
|
|
1f20c2 |
|
|
|
1f20c2 |
if (!array)
|
|
|
1f20c2 |
- array = xmalloc (pk->fprlen);
|
|
|
1f20c2 |
+ return;
|
|
|
1f20c2 |
|
|
|
1f20c2 |
if (pk->fprlen == 32) /* v5 fingerprint */
|
|
|
1f20c2 |
{
|
|
|
1f20c2 |
--
|
|
|
1f20c2 |
2.30.2
|
|
|
1f20c2 |
|