From f055cc84f7d851ebf0f990f91e78e5e3b3514479 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Mon, 9 Jul 2001 14:40:35 +0000 Subject: [PATCH] (krb5_sock_to_principal): copy hname before calling krb5_sname_to_principal. from "Jacques A. Vidrine" git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10298 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/sock_principal.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/krb5/sock_principal.c b/lib/krb5/sock_principal.c index b7994dba6..2c9b5dc8a 100644 --- a/lib/krb5/sock_principal.c +++ b/lib/krb5/sock_principal.c @@ -82,9 +82,16 @@ krb5_sock_to_principal (krb5_context context, } } - return krb5_sname_to_principal (context, - hname, - sname, - type, - ret_princ); + hname = strdup(hname); + if (hname == NULL) { + krb5_set_error_string (context, "malloc: out of memory"); + return ENOMEM; + } + ret = krb5_sname_to_principal (context, + hname, + sname, + type, + ret_princ); + free(hname); + return ret; }