From: Greg Hudson Date: Fri, 1 May 2009 20:11:01 +0000 (+0000) Subject: Check return value of ftell() in krb5_ktfileint_find_slot X-Git-Tag: krb5-1.8-alpha1~506 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fd4948f0e07fa73f364537773b7cbc3ecf2ac541;p=krb5.git Check return value of ftell() in krb5_ktfileint_find_slot git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22301 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/keytab/kt_file.c b/src/lib/krb5/keytab/kt_file.c index bb2d838d3..4139da5e0 100644 --- a/src/lib/krb5/keytab/kt_file.c +++ b/src/lib/krb5/keytab/kt_file.c @@ -1655,6 +1655,8 @@ krb5_ktfileint_find_slot(krb5_context context, krb5_keytab id, krb5_int32 *size_ for (;;) { commit_point = ftell(fp); + if (commit_point == -1) + return errno; if (!fread(&size, sizeof(size), 1, fp)) { /* Hit the end of file, reserve this slot. */ /* htonl(0) is 0, so no need to worry about byte order */ @@ -1685,6 +1687,8 @@ krb5_ktfileint_find_slot(krb5_context context, krb5_keytab id, krb5_int32 *size_ /* Empty record at end of file; use it. */ /* Ensure the new record will be followed by another 0. */ zero_point = ftell(fp); + if (zero_point == -1) + return errno; if (fseek(fp, *size_needed, SEEK_CUR)) return errno; /* htonl(0) is 0, so no need to worry about byte order */