Fixed fence post errors; assigned the principal type
authorTheodore Tso <tytso@mit.edu>
Fri, 29 May 1992 03:25:04 +0000 (03:25 +0000)
committerTheodore Tso <tytso@mit.edu>
Fri, 29 May 1992 03:25:04 +0000 (03:25 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2280 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/parse.c

index 3613975de3d9dcb73f0de6702b4f950db99bc27a..b1aacb2a7f9e3de28c72bf28c8f23818868cedf1 100644 (file)
@@ -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);
 }