[krbdev.mit.edu #8735] GSS buffer set failures on Windows due to gssalloc_realloc()

Greg Hudson via RT rt-comment at KRBDEV-PROD-APP-1.mit.edu
Thu Sep 13 10:48:37 EDT 2018


Thanks for the report.  The MSDN documentation for HeapReAlloc() does 
say that the input pointer "is returned by an earlier call to the 
HeapAlloc or HeapReAlloc function" so I guess it is within its rights 
to fail on a NULL input, unlike C's realloc().

Do you have a patch that you have tested for this issue?  My initial 
inclination is to change the Windows definition of gssalloc_realloc() 
(in gssapi_alloc.h) to:

static inline void *
gssalloc_realloc(void *value, size_t size)
{
    /* Unlike realloc(), HeapReAlloc() does not work on NULL. */
    if (value == NULL)
        return HeapAlloc(GetProcessHeap(), 0, size);
    return HeapReAlloc(GetProcessHeap(), 0, value, size);
}


More information about the krb5-bugs mailing list