[30486] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Fix potential close(-1) in cc_file.c

daemon@ATHENA.MIT.EDU (Greg Hudson)
Thu Apr 18 16:54:14 2019

Date: Thu, 18 Apr 2019 16:53:58 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-ID: <201904182053.x3IKrwQ3026263@drugstore.mit.edu>
To: <cvs-krb5@mit.edu>
MIME-Version: 1.0
Reply-To: krbdev@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/5ccfbaf2f0c8871d2f0ea87ad4b21cc33392ca2c
commit 5ccfbaf2f0c8871d2f0ea87ad4b21cc33392ca2c
Author: Robbie Harwood <rharwood@redhat.com>
Date:   Thu Apr 18 13:39:37 2019 -0400

    Fix potential close(-1) in cc_file.c
    
    As part of error handling in d3b39a8bac6206b5ea78b0bf6a2958c1df0b0dd5,
    an error path in delete_cred() may result in close(-1).  While this
    shouldn't be a prolblem in practice (just returning EBADF), it does
    upset Coverity.
    
    ticket: 8792

 src/lib/krb5/ccache/cc_file.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/lib/krb5/ccache/cc_file.c b/src/lib/krb5/ccache/cc_file.c
index f0f1409..e78ac3a 100644
--- a/src/lib/krb5/ccache/cc_file.c
+++ b/src/lib/krb5/ccache/cc_file.c
@@ -1122,7 +1122,8 @@ delete_cred(krb5_context context, krb5_ccache cache, krb5_cc_cursor *cursor,
     }
 
 cleanup:
-    close(fd);
+    if (fd >= 0)
+        close(fd);
     zapfree(on_disk, expected.len);
     k5_buf_free(&expected);
     k5_buf_free(&overwrite);
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post