gpgme-tool: Fix segv for external key listing.

* src/gpgme-tool.c (result_xml_escape): Allow for DATA being NULL.
This commit is contained in:
Werner Koch 2014-08-12 17:42:08 +02:00
parent bfe18a0651
commit e5ab116072

View File

@ -831,14 +831,17 @@ result_xml_escape (const char *data, char **buf)
membuf_t mb;
init_membuf (&mb, 128);
data_len = strlen (data);
for (i = 0; i < data_len; i++)
if (data)
{
r = result_xml_escape_replacement (data[i]);
if (r)
put_membuf (&mb, r, strlen (r));
else
put_membuf (&mb, data+i, 1);
data_len = strlen (data);
for (i = 0; i < data_len; i++)
{
r = result_xml_escape_replacement (data[i]);
if (r)
put_membuf (&mb, r, strlen (r));
else
put_membuf (&mb, data+i, 1);
}
}
put_membuf (&mb, "", 1);
*buf = get_membuf (&mb, NULL);