Skip to content

Commit

Permalink
Handle notation->name == NULL (signature policy)
Browse files Browse the repository at this point in the history
This means (according to the GPGME docs) that the notation->value
contains a signature policy URL.

Without this change, I get an ArgumentError (NULL pointer given).
  • Loading branch information
Michael Stapelberg authored and ueno committed Apr 2, 2012
1 parent 9be29cb commit 0a34f2b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ext/gpgme/gpgme_n.c
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,13 @@ rb_s_gpgme_op_verify_result (VALUE dummy, VALUE vctx)
notation = notation->next)
{
VALUE vnotation = rb_class_new_instance(0, NULL, cSigNotation);
rb_iv_set (vnotation, "@name", rb_str_new2 (notation->name));
/* The docs say:
* The name of the notation field. If this is NULL, then the member
* value will contain a policy URL. */
if (notation->name == NULL)
rb_iv_set (vnotation, "@name", Qnil);
else
rb_iv_set (vnotation, "@name", rb_str_new2 (notation->name));
rb_iv_set (vnotation, "@value", rb_str_new2 (notation->value));
rb_ary_push (vnotations, vnotation);
}
Expand Down

0 comments on commit 0a34f2b

Please sign in to comment.