Skip to content

Possible read out-of-bounds in con_write #68

@trustytrojan

Description

@trustytrojan

while(i<len) {
chr = *(tmp++);

I got a crash/exception on line 223 when calling std::ostream::write(char *, size_t) with buffers of unknown size (coming from libcurl during an HTTP request). By instead iterating the buffer myself and calling libc's putchar or libstdc++'s std::ostream::operator<<(char), there was no crash/exception.

I believe this might be due to the loop check on line 221 not checking for a possible early null-termination. A possible fix would be:

while (*tmp && i < len)

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