From: Theodore Tso Date: Fri, 29 May 1992 03:25:04 +0000 (+0000) Subject: Fixed fence post errors; assigned the principal type X-Git-Tag: krb5-1.0-beta2~182 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5c213170ad8576d1ee341eb4bc06e6e6da32072b;p=krb5.git Fixed fence post errors; assigned the principal type git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2280 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/parse.c b/src/lib/krb5/krb/parse.c index 3613975de..b1aacb2a7 100644 --- a/src/lib/krb5/krb/parse.c +++ b/src/lib/krb5/krb/parse.c @@ -196,20 +196,21 @@ krb5_parse_name(name, nprincipal) * usual case), then just copy the sizes to the * principal structure */ - for (i=0; i <= components; i++) + for (i=0; i < components; i++) krb5_princ_component(principal, i)->length = fcompsize[i]; + krb5_princ_realm(principal)->length = size; } /* * Now, we need to allocate the space for the strings themselves..... */ - tmpdata = malloc(realmsize); + tmpdata = malloc(realmsize+1); if (tmpdata == 0) { xfree(principal->data); xfree(principal); return ENOMEM; } krb5_princ_set_realm_data(principal, tmpdata); - for (i=0; i <= components; i++) { + for (i=0; i < components; i++) { char *tmpdata = malloc(krb5_princ_component(principal, i)->length + 1); if (!tmpdata) { @@ -265,6 +266,7 @@ krb5_parse_name(name, nprincipal) * Alright, we're done. Now stuff a pointer to this monstrosity * into the return variable, and let's get out of here. */ + krb5_princ_type(principal) = KRB5_NT_PRINCIPAL; *nprincipal = principal; return(0); }