Skip to content

Commit 6b0d115

Browse files
zoff99robinlinden
authored andcommitted
fix: remove the assert because buffer can be larger than UINT16_MAX.
1 parent 452a02f commit 6b0d115

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
261754f9fc58cd2d229488f00ea3503afbcc797cebcd10af1fad9e1adb3faf46 /usr/local/bin/tox-bootstrapd
1+
f80fc29c2a87f393fb84d56289ccfcc2e9860013627b20d76b6dfa56c8a8ffeb /usr/local/bin/tox-bootstrapd

toxcore/network.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,8 +1791,7 @@ Socket net_socket(const Network *ns, Family domain, int type, int protocol)
17911791
uint16_t net_socket_data_recv_buffer(const Network *ns, Socket sock)
17921792
{
17931793
const int count = ns->funcs->recvbuf(ns->obj, sock.sock);
1794-
assert(count >= 0 && count <= UINT16_MAX);
1795-
return (uint16_t)count;
1794+
return (uint16_t)max_s32(0, min_s32(count, UINT16_MAX));
17961795
}
17971796

17981797
uint32_t net_htonl(uint32_t hostlong)

0 commit comments

Comments
 (0)