aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/ks-engine-ldap.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-10-25 15:21:52 +0000
committerWerner Koch <[email protected]>2018-10-25 15:37:53 +0000
commit26ebb15bec897a105b248680c1ddf1806592b1eb (patch)
tree88da85a14f83ddc16f08581227cfb2a6507f5def /dirmngr/ks-engine-ldap.c
parentagent: Fix possible uninitalized use of CTX in simple_pwquery. (diff)
downloadgnupg-26ebb15bec897a105b248680c1ddf1806592b1eb.tar.gz
gnupg-26ebb15bec897a105b248680c1ddf1806592b1eb.zip
dirmngr: Fix out of scope use of a var in the keyserver LDAP code.
* dirmngr/ks-engine-ldap.c (extract_attributes): Don't use a variabale out of scope and cleanup the entire pgpKeySize block. -- GnuPG-bug-id: 4229 Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 2b57a8159cdc3b212a4efc68787b40cafcd91ebe)
Diffstat (limited to '')
-rw-r--r--dirmngr/ks-engine-ldap.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/dirmngr/ks-engine-ldap.c b/dirmngr/ks-engine-ldap.c
index f50ba50d0..d94bd5e25 100644
--- a/dirmngr/ks-engine-ldap.c
+++ b/dirmngr/ks-engine-ldap.c
@@ -1694,26 +1694,16 @@ extract_attributes (LDAPMod ***modlist, char *line)
if (is_pub || is_sub)
{
- char *size = fields[2];
- int val = atoi (size);
- size = NULL;
+ char padded[6];
+ int val;
- if (val > 0)
- {
- /* We zero pad this on the left to make PGP happy. */
- char padded[6];
- if (val < 99999 && val > 0)
- {
- snprintf (padded, sizeof padded, "%05u", val);
- size = padded;
- }
- }
-
- if (size)
- {
- if (is_pub || is_sub)
- modlist_add (modlist, "pgpKeySize", size);
- }
+ val = atoi (fields[2]);
+ if (val < 99999 && val > 0)
+ {
+ /* We zero pad this on the left to make PGP happy. */
+ snprintf (padded, sizeof padded, "%05u", val);
+ modlist_add (modlist, "pgpKeySize", padded);
+ }
}
if (is_pub)
@@ -1736,10 +1726,7 @@ extract_attributes (LDAPMod ***modlist, char *line)
}
if (algo)
- {
- if (is_pub)
- modlist_add (modlist, "pgpKeyType", algo);
- }
+ modlist_add (modlist, "pgpKeyType", algo);
}
if (is_pub || is_sub || is_sig)