STATUS_STACK_BUFFER_OVERRUN in completion_callback(WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE)

https://github.com/microsoft/cpprestsdk/blob/master/Release/src/http/client/http_client_winhttp.cpp#L2061

case WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE:
            {
                // First need to query to see what the headers size is.
                DWORD headerBufferLength = 0;
                query_header_length(hRequestHandle, WINHTTP_QUERY_RAW_HEADERS_CRLF, headerBufferLength);

                // Now allocate buffer for headers and query for them.
                std::vector<unsigned char> header_raw_buffer;
                header_raw_buffer.resize(headerBufferLength);
                utf16char* header_buffer = reinterpret_cast<utf16char*>(&header_raw_buffer[0]);

We need to check that headerBufferLength > 0 before accessing header_raw_buffer[0] here.

I'd left my application running in the debugger, the virtual machine suspended and resumed, and the resulting STATUS_STACK_BUFFER_OVERRUN (0xC0000409) took down the application.