Skip to content

Resolve "crash while receiving 64 kiB message over TCP"

Arаm Sаrgsyаn requested to merge 4273-streamdns-eagain into main

Handle cases when buf_size is zero

The isc_dnsstream_assembler_incoming() inline function expects that when 'buf_size' is zero, then 'buf' must be NULL. The expectation is not correct, because those values come from the libuv read callback, and its documentation notes[1] that 'nread' ('buf_size' here) might be 0, which does not indicate an error or EOF, but is equivalent to EAGAIN or EWOULDBLOCK under read(2).

Change the isc_dnsstream_assembler_incoming() inline function to remove the invalid expectation.

[1] https://docs.libuv.org/en/v1.x/stream.html#c.uv_read_cb

Closes #4273 (closed)

Edited by Arаm Sаrgsyаn

Merge request reports