From: Theodore Tso Date: Thu, 24 Sep 1992 23:22:13 +0000 (+0000) Subject: Modified to initialize the krb5 principal type information. Also modified X-Git-Tag: krb5-1.0-beta2~65 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=af6d38fcf7ba2a84bfb657762523c0c4a8c2899e;p=krb5.git Modified to initialize the krb5 principal type information. Also modified to zero terminate the principal strings. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2397 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/bld_pr_ext.c b/src/lib/krb5/krb/bld_pr_ext.c index ca2697335..625d9697f 100644 --- a/src/lib/krb5/krb/bld_pr_ext.c +++ b/src/lib/krb5/krb/bld_pr_ext.c @@ -83,7 +83,7 @@ va_dcl } princ_ret->data = princ_data; princ_ret->length = count; - tmpdata = malloc(rlen); + tmpdata = malloc(rlen+1); if (!tmpdata) { xfree(princ_data); xfree(princ_ret); @@ -92,6 +92,7 @@ va_dcl krb5_princ_set_realm_length(princ_ret, rlen); krb5_princ_set_realm_data(princ_ret, tmpdata); memcpy(tmpdata, realm, rlen); + tmpdata[rlen] = 0; /* process rest of components */ #if __STDC__ || defined(STDARG_PROTOTYPES) @@ -103,13 +104,15 @@ va_dcl size = va_arg(ap, int); next = va_arg(ap, char *); princ_data[i].length = size; - princ_data[i].data = malloc(size); + princ_data[i].data = malloc(size+1); if (!princ_data[i].data) goto free_out; memcpy(princ_data[i].data, next, size); + princ_data[i].data[size] = 0; } va_end(ap); *princ = princ_ret; + krb5_princ_type(princ_ret) = KRB5_NT_UNKNOWN; return 0; free_out: