Skip to content

Commit

Permalink
Fix gssalloc_realloc() on Windows
Browse files Browse the repository at this point in the history
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
  • Loading branch information
greghudson committed Oct 22, 2019
1 parent b835476 commit d66b311
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/gssapi/generic/gssapi_alloc.h
Expand Up @@ -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);
}

Expand Down

0 comments on commit d66b311

Please sign in to comment.