aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2024-12-09 21:14:01 +0100
committerGitHub <noreply@github.com>2024-12-09 21:14:01 +0100
commit2494c088f0aacb50305b1c05a81ea64a28b21caf (patch)
tree5fd26ac216100afe937648bde8e607cd1ba3a1e2 /src
parent467859c2ba0beadbb536ebde919e3883c7b4bc11 (diff)
downloadlibuv-2494c088f0aacb50305b1c05a81ea64a28b21caf.tar.gz
libuv-2494c088f0aacb50305b1c05a81ea64a28b21caf.zip
unix,win: handle nbufs=0 in uv_udp_try_send (#4641)
Diffstat (limited to 'src')
-rw-r--r--src/unix/udp.c3
-rw-r--r--src/win/udp.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/unix/udp.c b/src/unix/udp.c
index f6640fc7..c3e30314 100644
--- a/src/unix/udp.c
+++ b/src/unix/udp.c
@@ -793,7 +793,8 @@ int uv__udp_try_send(uv_udp_t* handle,
struct msghdr h;
ssize_t size;
- assert(nbufs > 0);
+ if (nbufs < 1)
+ return UV_EINVAL;
/* already sending a message */
if (handle->send_queue_count != 0)
diff --git a/src/win/udp.c b/src/win/udp.c
index 5c8f6e1d..557b4e60 100644
--- a/src/win/udp.c
+++ b/src/win/udp.c
@@ -1101,7 +1101,8 @@ int uv__udp_try_send(uv_udp_t* handle,
struct sockaddr_storage converted;
int err;
- assert(nbufs > 0);
+ if (nbufs < 1)
+ return UV_EINVAL;
if (addr != NULL) {
err = uv__convert_to_localhost_if_unspecified(addr, &converted);