svn rev #22301: trunk/src/lib/krb5/keytab/

ghudson@MIT.EDU ghudson at MIT.EDU
Fri May 1 16:11:01 EDT 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22301
Commit By: ghudson
Log Message:
Check return value of ftell() in krb5_ktfileint_find_slot.



Changed Files:
U   trunk/src/lib/krb5/keytab/kt_file.c
Modified: trunk/src/lib/krb5/keytab/kt_file.c
===================================================================
--- trunk/src/lib/krb5/keytab/kt_file.c	2009-05-01 20:07:13 UTC (rev 22300)
+++ trunk/src/lib/krb5/keytab/kt_file.c	2009-05-01 20:11:01 UTC (rev 22301)
@@ -1655,6 +1655,8 @@
 
     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 @@
 	    /* 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 */




More information about the cvs-krb5 mailing list