Package: libheimdal-kadm5-perl
Version: 0.08-3
Tags: patch

The sequence

  $client = new Heimdal::Kadm5::Client (Principal => 'admin');
  $princ = $client->makePrincipal ('newprinc');
  $princ->dump;

results in:

[some lines omitted]
        Last modified: never
Segmentation fault

I've tested the attached patch which appears to solve the problem.
Guard against null pointer dereference in second argument to krb5_unparse_name.
--- a/Kadm5.xs
+++ b/Kadm5.xs
@@ -737,14 +737,19 @@
        char *p;
        krb5_error_code ret;
        
-       ret = 
krb5_unparse_name(spp->handle->context,spp->principal.mod_name,&p);
-       if (ret)
+       if (spp->principal.mod_name) 
+       {
+         ret = 
krb5_unparse_name(spp->handle->context,spp->principal.mod_name,&p);
+         if (ret)
         {
           safefree(p);
           croak("[Heimdal::Kadm5] krb5_unparse_name failed: %s\n",
                 krb5_get_err_text(spp->handle->context, ret));
         }
-       RETVAL = newSVpv(p,0);
+        RETVAL = newSVpv(p,0);
+       }
+       else
+        RETVAL = &PL_sv_undef;
      }
      OUTPUT:
      RETVAL

Reply via email to