In krb5_ktfileint_find_slot, check for an error return from ftell.
authorGreg Hudson <ghudson@mit.edu>
Thu, 5 Feb 2009 18:34:57 +0000 (18:34 +0000)
committerGreg Hudson <ghudson@mit.edu>
Thu, 5 Feb 2009 18:34:57 +0000 (18:34 +0000)
(Such an error will never happen in any reasonable stdio
implementation but it's more correct to check.)

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

src/lib/krb5/keytab/kt_file.c

index ecdc28a2517d0f92a47d4d2d54b5c9ce96da1c79..df5cbb0bac6a5bf520a3842d9eb88200950bea13 100644 (file)
@@ -1722,6 +1722,9 @@ krb5_ktfileint_find_slot(krb5_context context, krb5_keytab id, krb5_int32 *size_
                  * Make sure we zero any trailing data.
                  */
                 zero_point = ftell(KTFILEP(id));
+                if (zero_point < 0) {
+                    return errno;
+                }
                 while ((size = fread(iobuf, 1, sizeof(iobuf), KTFILEP(id)))) {
                     if (size != sizeof(iobuf)) {
                         remainder = size % sizeof(krb5_int32);