]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix leash crash found in some build environments
authorBen Kaduk <kaduk@mit.edu>
Tue, 14 Apr 2015 19:33:20 +0000 (15:33 -0400)
committerTom Yu <tlyu@mit.edu>
Wed, 13 May 2015 20:15:22 +0000 (16:15 -0400)
When freeing a credentials cache name obtained from
krb5_cc_get_full_name(), the code was using plain free()
instead of the matching krb5_free_string().  If these routines
are picked from different modules at runtime, the mismatch
will cause a crash in free(), so change to using the matched
deallocation function.

In order to use it in leash, it must be declared in Lglobals.h and
the function pointer symbol defined in Leash.cpp.

(cherry picked from commit ebeb1e359fa10ea710d467ca3756ababd1276fa6)

ticket: 8189
version_fixed: 1.13.3
status: resolved

src/windows/leash/KrbListTickets.cpp
src/windows/leash/Leash.cpp
src/windows/leash/Lglobals.h

index 71a4c635cce272b0674e6c3212eae21c40f15d9e..f34830cbabfe64816c606ef990bc676c7a7797f1 100644 (file)
@@ -27,7 +27,7 @@ LeashKRB5FreeTicketInfo(TICKETINFO *ticketinfo)
         ticketinfo->principal = NULL;
     }
     if (ticketinfo->ccache_name) {
-        free(ticketinfo->ccache_name);
+        pkrb5_free_string(NULL, ticketinfo->ccache_name);
         ticketinfo->ccache_name = NULL;
     }
     if (ticketinfo->ticket_list)
index 6153499f9607e5c88ba76e57941f0ff1ed8369af..beead0ce25811139e5184b56c8fabae74604b3fe 100644 (file)
@@ -693,6 +693,7 @@ DECL_FUNC_PTR(krb5_get_renewed_creds);
 DECL_FUNC_PTR(krb5_cc_initialize);
 DECL_FUNC_PTR(krb5_cc_store_cred);
 DECL_FUNC_PTR(krb5_cc_get_full_name);
+DECL_FUNC_PTR(krb5_free_string);
 DECL_FUNC_PTR(krb5_enctype_to_name);
 DECL_FUNC_PTR(krb5_cc_get_type);
 DECL_FUNC_PTR(krb5int_cc_user_set_default_name);
@@ -736,6 +737,7 @@ FUNC_INFO krb5_fi[] = {
     MAKE_FUNC_INFO(krb5_cc_initialize),
     MAKE_FUNC_INFO(krb5_cc_store_cred),
     MAKE_FUNC_INFO(krb5_cc_get_full_name),
+    MAKE_FUNC_INFO(krb5_free_string),
     MAKE_FUNC_INFO(krb5_enctype_to_name),
     MAKE_FUNC_INFO(krb5_cc_get_type),
     MAKE_FUNC_INFO(krb5int_cc_user_set_default_name),
index 87fdd099356237105cf952e8465c079d8ccf276d..7141d79e0bb8c07fd98f7e16f72002b3a379c934 100644 (file)
@@ -181,6 +181,7 @@ extern DECL_FUNC_PTR(krb5_get_renewed_creds);
 extern DECL_FUNC_PTR(krb5_cc_initialize);
 extern DECL_FUNC_PTR(krb5_cc_store_cred);
 extern DECL_FUNC_PTR(krb5_cc_get_full_name);
+extern DECL_FUNC_PTR(krb5_free_string);
 extern DECL_FUNC_PTR(krb5_enctype_to_name);
 extern DECL_FUNC_PTR(krb5_cc_get_type);
 extern DECL_FUNC_PTR(krb5int_cc_user_set_default_name);