From: John Kohl Date: Tue, 1 May 1990 17:05:08 +0000 (+0000) Subject: cast read() X-Git-Tag: krb5-1.0-alpha2~749 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=06a0e792e9c168fc570a9637fbe1874003ed1394;p=krb5.git cast read() allocate proper # entries in principal array git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@647 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/file/fcc_read.c b/src/lib/krb5/ccache/file/fcc_read.c index f03518958..c3a94ab71 100644 --- a/src/lib/krb5/ccache/file/fcc_read.c +++ b/src/lib/krb5/ccache/file/fcc_read.c @@ -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)