[28864] in CVS-changelog-for-Kerberos-V5
krb5 commit: Fix leash crash found in some build environments
daemon@ATHENA.MIT.EDU (Benjamin Kaduk)
Thu Apr 30 13:08:28 2015
Date: Thu, 30 Apr 2015 13:08:22 -0400
From: Benjamin Kaduk <kaduk@mit.edu>
Message-Id: <201504301708.t3UH8MEV020419@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu
https://github.com/krb5/krb5/commit/ebeb1e359fa10ea710d467ca3756ababd1276fa6
commit ebeb1e359fa10ea710d467ca3756ababd1276fa6
Author: Ben Kaduk <kaduk@mit.edu>
Date: Tue Apr 14 15:33:20 2015 -0400
Fix leash crash found in some build environments
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 | 2 +-
src/windows/leash/Leash.cpp | 2 ++
src/windows/leash/Lglobals.h | 1 +
3 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/windows/leash/KrbListTickets.cpp b/src/windows/leash/KrbListTickets.cpp
index 63ce046..beab0ea 100644
--- a/src/windows/leash/KrbListTickets.cpp
+++ b/src/windows/leash/KrbListTickets.cpp
@@ -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)
diff --git a/src/windows/leash/Leash.cpp b/src/windows/leash/Leash.cpp
index 6153499..beead0c 100644
--- a/src/windows/leash/Leash.cpp
+++ b/src/windows/leash/Leash.cpp
@@ -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),
diff --git a/src/windows/leash/Lglobals.h b/src/windows/leash/Lglobals.h
index 87fdd09..7141d79 100644
--- a/src/windows/leash/Lglobals.h
+++ b/src/windows/leash/Lglobals.h
@@ -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);
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5