Showing
3 changed files
with
11 additions
and
2 deletions
... | ... | @@ -89,10 +89,13 @@ static |
89 | 89 | TR_RemoteData |
90 | 90 | tcpSocketRecv(TR_Socket this, size_t size) |
91 | 91 | { |
92 | - unsigned char buffer[size = size>8192 ? 8192 : size]; | |
93 | 92 | TR_RemoteData rdata = NULL; |
94 | 93 | ssize_t received; |
95 | 94 | |
95 | + size = size>TR_TCP_MAX_READ_BLOCK ? TR_TCP_MAX_READ_BLOCK : size; | |
96 | + | |
97 | + unsigned char buffer[size]; | |
98 | + | |
96 | 99 | received = recv(this->handle, buffer, size, this->flags); |
97 | 100 | |
98 | 101 | if (-1 == received) { | ... | ... |
... | ... | @@ -51,11 +51,14 @@ static |
51 | 51 | TR_RemoteData |
52 | 52 | udpSocketRecv(TR_Socket this, size_t size) |
53 | 53 | { |
54 | - unsigned char buffer[size = size>8192 ? 8192 : size]; | |
55 | 54 | ssize_t received; |
56 | 55 | TR_RemoteData rdata; |
57 | 56 | TR_Socket remote = TR_new(TR_UdpSocket, this->log, NULL, 0, 0); |
58 | 57 | |
58 | + size = size>TR_UDP_MAX_READ_BLOCK ? TR_UDP_MAX_READ_BLOCK : size; | |
59 | + | |
60 | + unsigned char buffer[size]; | |
61 | + | |
59 | 62 | remote->addrlen = this->addrlen; |
60 | 63 | |
61 | 64 | received = recvfrom( | ... | ... |
Please
register
or
login
to post a comment