forked from EXTERNAL/bareiron
implement recv_buffer size limit and input validation
* Implement recv_buffer size limit and input validation * Add readLengthPrefixedData helper and refactor some read flows * Change error to be more accurate * Add newline to error message * fix long chat messages kicking clients * style nitpicks --------- Co-authored-by: p2r3 <p2r3@p2r3.com> Co-authored-by: p2r3 <41925384+p2r3@users.noreply.github.com>
This commit is contained in:
@@ -102,6 +102,9 @@
|
||||
// clients from Keep Alive packets.
|
||||
#define NETWORK_TIMEOUT_TIME 15000000
|
||||
|
||||
// Size of the receive buffer for incoming string data
|
||||
#define MAX_RECV_BUF_LEN 256
|
||||
|
||||
// If defined, sends the server brand to clients. Doesn't do much, but will
|
||||
// show up in the top-left of the F3/debug menu, in the Minecraft client.
|
||||
// You can change the brand string in the "brand" variable in src/globals.c
|
||||
|
@@ -32,7 +32,9 @@ int64_t readInt64 (int client_fd);
|
||||
float readFloat (int client_fd);
|
||||
double readDouble (int client_fd);
|
||||
|
||||
ssize_t readLengthPrefixedData (int client_fd);
|
||||
void readString (int client_fd);
|
||||
void readStringN (int client_fd, uint32_t max_length);
|
||||
|
||||
uint32_t fast_rand ();
|
||||
uint64_t splitmix64 (uint64_t state);
|
||||
|
Reference in New Issue
Block a user