Commit a0975ff3e932d21091f6e668e443d3f966f14009

Authored by Georg Hopp
1 parent 23ecc0b4

small buffer size related fix

@@ -89,8 +89,8 @@ static @@ -89,8 +89,8 @@ static
89 TR_RemoteData 89 TR_RemoteData
90 tcpSocketRecv(TR_Socket this, size_t size) 90 tcpSocketRecv(TR_Socket this, size_t size)
91 { 91 {
  92 + unsigned char buffer[size = size>8192 ? 8192 : size];
92 TR_RemoteData rdata = NULL; 93 TR_RemoteData rdata = NULL;
93 - unsigned char buffer[size];  
94 ssize_t received; 94 ssize_t received;
95 95
96 received = recv(this->handle, buffer, size, this->flags); 96 received = recv(this->handle, buffer, size, this->flags);
@@ -51,7 +51,7 @@ static @@ -51,7 +51,7 @@ static
51 TR_RemoteData 51 TR_RemoteData
52 udpSocketRecv(TR_Socket this, size_t size) 52 udpSocketRecv(TR_Socket this, size_t size)
53 { 53 {
54 - unsigned char buffer[size>8192 ? 8192 : size]; 54 + unsigned char buffer[size = size>8192 ? 8192 : size];
55 ssize_t received; 55 ssize_t received;
56 TR_RemoteData rdata; 56 TR_RemoteData rdata;
57 TR_Socket remote = TR_new(TR_UdpSocket, this->log, NULL, 0, 0); 57 TR_Socket remote = TR_new(TR_UdpSocket, this->log, NULL, 0, 0);
@@ -63,7 +63,7 @@ udpSocketRecv(TR_Socket this, size_t size) @@ -63,7 +63,7 @@ udpSocketRecv(TR_Socket this, size_t size)
63 buffer, 63 buffer,
64 size, 64 size,
65 this->flags, 65 this->flags,
66 - (struct sockaddr *)&(remote->addr), 66 + &(remote->addr.info),
67 &remote->addrlen); 67 &remote->addrlen);
68 68
69 if (-1 == received) { 69 if (-1 == received) {
Please register or login to post a comment