[30596] in CVS-changelog-for-Kerberos-V5
krb5 commit: Fix gssalloc_realloc() on Windows
daemon@ATHENA.MIT.EDU (Greg Hudson)
Mon Oct 21 23:54:12 2019
Date: Mon, 21 Oct 2019 23:54:08 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-ID: <201910220354.x9M3s8tL001371@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/d66b311093f1782c3610bbc77bd78fce411e8f79
commit d66b311093f1782c3610bbc77bd78fce411e8f79
Author: Greg Hudson <ghudson@mit.edu>
Date: Mon Oct 21 10:29:35 2019 -0400
Fix gssalloc_realloc() on Windows
gss_inquire_sec_context_by_oid(GSS_C_INQ_SSPI_SESSION_KEY) fails on
Windows because generic_gss_add_buffer_set_member() relies on the
ability to realloc() a null pointer. Unlike realloc(), HeapReAlloc()
requires an input pointer that (from the MSDN documentation) "is
returned by an earlier call to the HeapAlloc or HeapReAlloc function".
So gssalloc_realloc() must test for null inputs and call HeapAlloc()
instead.
Reported by Eric Pauly.
ticket: 8735
tags: pullup
target_version: 1.17-next
src/lib/gssapi/generic/gssapi_alloc.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/lib/gssapi/generic/gssapi_alloc.h b/src/lib/gssapi/generic/gssapi_alloc.h
index 9a5cd98..fff88fd 100644
--- a/src/lib/gssapi/generic/gssapi_alloc.h
+++ b/src/lib/gssapi/generic/gssapi_alloc.h
@@ -36,6 +36,9 @@ gssalloc_calloc(size_t count, size_t size)
static inline void *
gssalloc_realloc(void *value, size_t size)
{
+ /* Unlike realloc(), HeapReAlloc() does not work on null values. */
+ if (value == NULL)
+ return HeapAlloc(GetProcessHeap(), 0, size);
return HeapReAlloc(GetProcessHeap(), 0, value, size);
}
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5