]> 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)
committerBen Kaduk <kaduk@mit.edu>
Thu, 30 Apr 2015 14:47:33 +0000 (10:47 -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.

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

index 63ce0462073a04860b2b66a8c1581375677f9389..beab0ea113395ad5c45961b3d55ed9a7a8701f7b 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);