fix: remove the assert because buffer can be larger than UINT16_MAX.

This commit is contained in:
zoff99 2022-04-17 20:33:51 +02:00 committed by Robin Linden
parent 452a02f729
commit 6b0d1151ac
No known key found for this signature in database
GPG Key ID: 601A604B7E605776
2 changed files with 2 additions and 3 deletions

View File

@ -1 +1 @@
261754f9fc58cd2d229488f00ea3503afbcc797cebcd10af1fad9e1adb3faf46 /usr/local/bin/tox-bootstrapd
f80fc29c2a87f393fb84d56289ccfcc2e9860013627b20d76b6dfa56c8a8ffeb /usr/local/bin/tox-bootstrapd

View File

@ -1791,8 +1791,7 @@ Socket net_socket(const Network *ns, Family domain, int type, int protocol)
uint16_t net_socket_data_recv_buffer(const Network *ns, Socket sock)
{
const int count = ns->funcs->recvbuf(ns->obj, sock.sock);
assert(count >= 0 && count <= UINT16_MAX);
return (uint16_t)count;
return (uint16_t)max_s32(0, min_s32(count, UINT16_MAX));
}
uint32_t net_htonl(uint32_t hostlong)