2010-08-03 Marcus Brinkmann <marcus@g10code.de>

* gpgme-tool.c (result_encrypt_to_xml, result_sign_to_xml)
	(result_verify_to_xml, result_import_to_xml)
        (result_genkey_to_xml):	Check vigorously for null pointers.
This commit is contained in:
Marcus Brinkmann 2010-08-03 09:16:01 +00:00
parent 6e5c9be0b6
commit 6aa92258ce
2 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,9 @@
2010-08-03 Marcus Brinkmann <marcus@g10code.de>
* gpgme-tool.c (result_encrypt_to_xml, result_sign_to_xml)
(result_verify_to_xml, result_import_to_xml)
(result_genkey_to_xml): Check vigorously for null pointers.
* w32-io.c (GPGCEDEV_IOCTL_ASSIGN_RVID): New macro.
(_gpgme_io_spawn): Use ASSIGN_RVID.

View File

@ -743,7 +743,7 @@ gpg_error_t
result_add_timestamp (struct result_xml_state *state, char *name,
unsigned int timestamp)
{
char code[20];
code[20];
snprintf (code, sizeof (code) - 1, "%ui", timestamp);
result_xml_tag_start (state, name, "unix", code, NULL);
@ -828,6 +828,7 @@ result_encrypt_to_xml (gpgme_ctx_t ctx, int indent,
while (inv_recp)
{
result_xml_tag_start (&state, "invalid-key", NULL);
if (inv_recp->fpr)
result_add_fpr (&state, "fpr", inv_recp->fpr);
result_add_error (&state, "reason", inv_recp->reason);
result_xml_tag_end (&state);
@ -917,6 +918,7 @@ result_sign_to_xml (gpgme_ctx_t ctx, int indent,
while (inv_key)
{
result_xml_tag_start (&state, "invalid-key", NULL);
if (inv_key->fpr)
result_add_fpr (&state, "fpr", inv_key->fpr);
result_add_error (&state, "reason", inv_key->reason);
result_xml_tag_end (&state);
@ -985,6 +987,7 @@ result_verify_to_xml (gpgme_ctx_t ctx, int indent,
/* FIXME: Could be done better. */
result_add_value (&state, "summary", sig->summary);
if (sig->fpr)
result_add_fpr (&state, "fpr", sig->fpr);
result_add_error (&state, "status", sig->status);
/* FIXME: notations */
@ -1050,6 +1053,7 @@ result_import_to_xml (gpgme_ctx_t ctx, int indent,
{
result_xml_tag_start (&state, "import-status", NULL);
if (stat->fpr)
result_add_fpr (&state, "fpr", stat->fpr);
result_add_error (&state, "result", stat->result);
/* FIXME: Could be done better. */
@ -1082,6 +1086,7 @@ result_genkey_to_xml (gpgme_ctx_t ctx, int indent,
result_add_value (&state, "primary", res->primary);
result_add_value (&state, "sub", res->sub);
if (res->fpr)
result_add_fpr (&state, "fpr", res->fpr);
result_xml_tag_end (&state);