From d4449a503f66a7434a18df3ba8ef862d6f14211c Mon Sep 17 00:00:00 2001 From: Barry Jaspan Date: Wed, 6 Nov 1996 23:18:46 +0000 Subject: [PATCH] * kadm_rpc_xdr.c (xdr_krb5_principal): handle a NULL principal pointer (this can happen when get_principal is passed a mask without KADM5_PRINCIPAL in it, and will cause a beta 7 kadmind to coredump) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9309 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kadm5/ChangeLog | 7 +++++++ src/lib/kadm5/kadm_rpc_xdr.c | 21 +++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/lib/kadm5/ChangeLog b/src/lib/kadm5/ChangeLog index d3d8e54ee..169c2e99f 100644 --- a/src/lib/kadm5/ChangeLog +++ b/src/lib/kadm5/ChangeLog @@ -1,3 +1,10 @@ +Wed Nov 6 17:45:43 1996 Barry Jaspan + + * kadm_rpc_xdr.c (xdr_krb5_principal): handle a NULL principal + pointer (this can happen when get_principal is passed a mask + without KADM5_PRINCIPAL in it, and will cause a beta 7 kadmind to + coredump) + Fri Nov 1 13:16:16 1996 Barry Jaspan * kadm_err.et: update for new tl_data semantics [krb5-admin/140] diff --git a/src/lib/kadm5/kadm_rpc_xdr.c b/src/lib/kadm5/kadm_rpc_xdr.c index 65a4fd7d7..478ee24c4 100644 --- a/src/lib/kadm5/kadm_rpc_xdr.c +++ b/src/lib/kadm5/kadm_rpc_xdr.c @@ -767,20 +767,25 @@ xdr_krb5_principal(XDR *xdrs, krb5_principal *objp) switch(xdrs->x_op) { case XDR_ENCODE: - if((ret = krb5_unparse_name(context, *objp, &p)) != 0) - return FALSE; + if (*objp) { + if((ret = krb5_unparse_name(context, *objp, &p)) != 0) + return FALSE; + } if(!xdr_nullstring(xdrs, &p)) return FALSE; - free(p); + if (p) free(p); break; case XDR_DECODE: if(!xdr_nullstring(xdrs, &p)) return FALSE; - ret = krb5_parse_name(context, p, &pr); - if(ret != 0) - return FALSE; - *objp = pr; - free(p); + if (p) { + ret = krb5_parse_name(context, p, &pr); + if(ret != 0) + return FALSE; + *objp = pr; + free(p); + } else + *objp = NULL; break; case XDR_FREE: if(*objp != NULL) -- 2.26.2