Permalink
Browse files

Handle notation->name == NULL (signature policy)

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...
1 parent 9be29cb commit 0a34f2b5db7d2528d844a07b12888f04fafbd504 Michael Stapelberg committed with Apr 1, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 ext/gpgme/gpgme_n.c
View
@@ -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);
}

0 comments on commit 0a34f2b

Please sign in to comment.