krb5 commit: Fix memory leak in PAC checksum verification

ghudson at mit.edu ghudson at mit.edu
Mon Oct 14 12:45:08 EDT 2024


https://github.com/krb5/krb5/commit/c03ac354436a7182962b4987d318a86cb7ac558b
commit c03ac354436a7182962b4987d318a86cb7ac558b
Author: Arjun <pkillarjun at protonmail.com>
Date:   Fri Oct 11 00:55:59 2024 +0530

    Fix memory leak in PAC checksum verification
    
    If the server checksum length is invalid, do proper cleanup in
    verify_pac_checksums() before returning.
    
    [ghudson at mit.edu: edited commit message]
    
    ticket: 9143 (new)
    tags: pullup
    target_version: 1.21-next

 src/lib/krb5/krb/pac.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lib/krb5/krb/pac.c b/src/lib/krb5/krb/pac.c
index 5d1fdf1ba..77adcd272 100644
--- a/src/lib/krb5/krb/pac.c
+++ b/src/lib/krb5/krb/pac.c
@@ -557,9 +557,11 @@ verify_pac_checksums(krb5_context context, const krb5_pac pac,
         ret = k5_pac_locate_buffer(context, pac, KRB5_PAC_SERVER_CHECKSUM,
                                    &server_checksum);
         if (ret)
-            return ret;
-        if (server_checksum.length < PAC_SIGNATURE_DATA_LENGTH)
-            return KRB5_BAD_MSIZE;
+            goto cleanup;
+        if (server_checksum.length < PAC_SIGNATURE_DATA_LENGTH) {
+            ret = KRB5_BAD_MSIZE;
+            goto cleanup;
+        }
         server_checksum.data += PAC_SIGNATURE_DATA_LENGTH;
         server_checksum.length -= PAC_SIGNATURE_DATA_LENGTH;
 


More information about the cvs-krb5 mailing list