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,6 +831,8 @@ result_xml_escape (const char *data, char **buf)
membuf_t mb; membuf_t mb;
init_membuf (&mb, 128); init_membuf (&mb, 128);
if (data)
{
data_len = strlen (data); data_len = strlen (data);
for (i = 0; i < data_len; i++) for (i = 0; i < data_len; i++)
{ {
@ -840,6 +842,7 @@ result_xml_escape (const char *data, char **buf)
else else
put_membuf (&mb, data+i, 1); put_membuf (&mb, data+i, 1);
} }
}
put_membuf (&mb, "", 1); put_membuf (&mb, "", 1);
*buf = get_membuf (&mb, NULL); *buf = get_membuf (&mb, NULL);
return *buf? 0 : gpg_error_from_syserror (); return *buf? 0 : gpg_error_from_syserror ();