cast read()
authorJohn Kohl <jtkohl@mit.edu>
Tue, 1 May 1990 17:05:08 +0000 (17:05 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Tue, 1 May 1990 17:05:08 +0000 (17:05 +0000)
allocate proper # entries in principal array

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@647 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/ccache/file/fcc_read.c

index f03518958d5e93af2547109010fb570669c27e6a..c3a94ab71b0e17c66d13316a9d514a812c3c14d2 100644 (file)
@@ -82,8 +82,10 @@ krb5_fcc_read_principal(id, princ)
       * krb5_data.
       */
 
-     /* Make *princ able to hold length pointers to krb5_data structs */
-     *princ = (krb5_principal) malloc(sizeof(krb5_data *)*length);
+     /* Make *princ able to hold length pointers to krb5_data structs
+      * Add one extra for a null-terminated list
+      */
+     *princ = (krb5_principal) calloc(length+1, sizeof(krb5_data *));
      if (*princ == NULL)
          return KRB5_NOMEM;
 
@@ -117,7 +119,7 @@ krb5_fcc_read_keyblock(id, keyblock)
      if (keyblock->contents == NULL)
          return KRB5_NOMEM;
      
-     ret = read(((krb5_fcc_data *) id->data)->fd, keyblock->contents,
+     ret = read(((krb5_fcc_data *) id->data)->fd, (char *)keyblock->contents,
                (keyblock->length)*sizeof(krb5_octet));
 
      if (ret < 0)