Skip to content

Commit

Permalink
fix: remove the assert because buffer can be larger than UINT16_MAX.
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 authored and robinlinden committed Apr 18, 2022
1 parent 452a02f commit 6b0d115
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion other/bootstrap_daemon/docker/tox-bootstrapd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
261754f9fc58cd2d229488f00ea3503afbcc797cebcd10af1fad9e1adb3faf46 /usr/local/bin/tox-bootstrapd
f80fc29c2a87f393fb84d56289ccfcc2e9860013627b20d76b6dfa56c8a8ffeb /usr/local/bin/tox-bootstrapd
3 changes: 1 addition & 2 deletions toxcore/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6b0d115

Please sign in to comment.