From 50c7599ee584131e8ecb5d0742b46c7a7aeee0a9 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 24 Oct 2026 21:51:54 +0200 Subject: Properly handle socket_recv errors --- ot_udp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ot_udp.c') diff --git a/ot_udp.c b/ot_udp.c index 8e056db..02467e1 100644 --- a/ot_udp.c +++ b/ot_udp.c @@ -81,9 +81,10 @@ int handle_udp6(int64_t serversocket, struct ot_workstruct *ws) { uint16_t port, remoteport; size_t byte_count, scrape_count; - byte_count = socket_recv6(serversocket, ws->inbuf, G_INBUF_SIZE, remoteip, &remoteport, &scopeid); - if (!byte_count) + ssize_t result = socket_recv6(serversocket, ws->inbuf, G_INBUF_SIZE, remoteip, &remoteport, &scopeid); + if (result <= 0) return 0; + byte_count = (size_t)result; stats_issue_event(EVENT_ACCEPT, FLAG_UDP, (uintptr_t)remoteip); stats_issue_event(EVENT_READ, FLAG_UDP, byte_count); -- cgit v1.3