Thanks to visit codestin.com
Credit goes to github.com

Skip to content

STATUS_STACK_BUFFER_OVERRUN in completion_callback(WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE)  #1212

@acs-godonnell

Description

@acs-godonnell

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions