net: fix crash if POLLHUP is received
If the onread
socket option is used and a POLLHUP
event is received,
libuv returns UV_EOF
along with a NULL
buffer in the read callback,
causing the crash. Deal with this case.
See: https://github.com/nodejs/node/blob/master/deps/uv/src/unix/stream.c#L1317-L1323
Fixes: https://github.com/nodejs/node/issues/31823
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines