diff options
author | Greg Hudson <ghudson@mit.edu> | 2009-05-01 20:11:01 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2009-05-01 20:11:01 +0000 |
commit | fd4948f0e07fa73f364537773b7cbc3ecf2ac541 (patch) | |
tree | e583692ff7ac59d57c8d487f85b1f7b9ac042bb6 /src/lib/krb5/keytab | |
parent | fb013ee162e24046b8e0270ff2e5626c8f8f398d (diff) | |
download | krb5-fd4948f0e07fa73f364537773b7cbc3ecf2ac541.tar.gz krb5-fd4948f0e07fa73f364537773b7cbc3ecf2ac541.tar.xz krb5-fd4948f0e07fa73f364537773b7cbc3ecf2ac541.zip |
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
Diffstat (limited to 'src/lib/krb5/keytab')
-rw-r--r-- | src/lib/krb5/keytab/kt_file.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/krb5/keytab/kt_file.c b/src/lib/krb5/keytab/kt_file.c index bb2d838d3d..4139da5e02 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 */ |