1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-10 21:38:50 +01:00

dirmngr: Don't use alloca.

* dirmngr/ks-engine-ldap.c (ks_ldap_put): Replace use of alloca with
xmalloc and xfree.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
Neal H. Walfield 2015-03-31 14:48:31 +02:00
parent 802eec0ca4
commit d0ff2ee041

View File

@ -1961,7 +1961,7 @@ ks_ldap_put (ctrl_t ctrl, parsed_uri_t uri,
/* The last line is not \n terminated! Make a copy so we can /* The last line is not \n terminated! Make a copy so we can
add a NUL terminator. */ add a NUL terminator. */
{ {
temp = alloca (infolen + 1); temp = xmalloc (infolen + 1);
memcpy (temp, info, infolen); memcpy (temp, info, infolen);
info = temp; info = temp;
newline = (char *) info + infolen; newline = (char *) info + infolen;
@ -1978,7 +1978,10 @@ ks_ldap_put (ctrl_t ctrl, parsed_uri_t uri,
if (! temp) if (! temp)
assert ((char *) info + infolen - 1 == infoend); assert ((char *) info + infolen - 1 == infoend);
else else
{
assert (infolen == -1); assert (infolen == -1);
xfree (temp);
}
} }
modlist_add (&addlist, "objectClass", "pgpKeyInfo"); modlist_add (&addlist, "objectClass", "pgpKeyInfo");